Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

My Script runner Script behaviour is working for create screen but not working for edit screen .

My Script runner Script behaviour is working for create screen but not working for edit screen .

Script runner Version:6.15.0  

Script code :

-----------------------------------------------------------

import com.onresolve.jira.groovy.user.FormField

 

def donorNameField = getFieldById("customfield_12331") // i.e Donor name field i.e Dropdown field
def donorNameFieldValue = donorNameField.getValue()


def OtherDonerNameField = getFieldById("customfield_11902") //ClearField field i.e Other Doner Name field

donorNameField.setRequired(true)
//-----------------------------------Logic To set text box to empty when you select "Other option from Drop down"------------------

if(donorNameFieldValue.toString().contains("Other"))
{


OtherDonerNameField.setHidden(false); // To Show it ---> we use "false"

OtherDonerNameField.setRequired(true)
}

else
{




OtherDonerNameField.setHidden(true); // To hide it ---> we use "true"

OtherDonerNameField.setFormValue(null) // to set empty when "other" is selected from dropdown , we passed Null to formField

OtherDonerNameField.setRequired(false)

}

 

 

-----------------------------------------------------------

Script working properly with create issue type ,but when i turn to edit the issue .behaviour  not working at all . Facing issue to keep   mandatory field . Because on edit  mandatory field can be make to empty  , which i dont want to .

 

Is there any restriction with Given version . 

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

479 views 5 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you