I'm trying set customfield1 to required only when customfield2 has a value in it. Customfield2 is a single line text fields, whilst customfield1 is a select list option. Here is what i've written so far in the server-side script which does not seem to do anything. Also note that this action should be triggered during edit screen and not through a workflow transition. What am I doing wrong?
com.atlassian.jira.issue.fields.CustomField
def customField = getFieldById("Entrance") // custom field main entrance
def customField2 = getFieldById("Entrance Number Tag") // custom field main entrance number tag
if(customField2 ==!null)
{ customField.setRequired(true)
customField.setHelpText("Please change this to Done")}
else
{ customField.setRequired(false)}
Managed to get this sorted by adding an initialiser. Here is my script:
def customField = getFieldByName("Entrance") // custom field main entrance rotterdam kralingen
def customField2 = getFieldByName("Entrance Number Tag") // custom field main entrance rotterdam kralingen number tag
customField2.setRequired(customField.getValue() == 'Done')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.