Hello!
I'm trying to implement a Behavior using Scriptrunner. I have a field for Severity that is required on a specific Service Desk request. Desired behavior is that if a user selects "High" value for Severity, a field (previously hidden) will appear for Emergency Justification, and this field will be required.
I modeled my code after the solution I found on this question, but it isn't working. Here's the code:
import com.atlassian.jira.issue.fields.CustomField
def CustomField = getFieldById("customfield_10408")
def Custom2Field = getFieldById("customfield_10622")
if (CustomField.getValue() == "High (Emergency)") {
Custom2Field.setRequired(true)
Custom2Field.setHidden(false)
}
else {
Custom2Field.setRequired(false)
Custom2Field.setHidden(true)
}
It appears to work partially, because customfield_10622 is set in the screen as not hidden, and it is hidden to the user when initially entering the Request. But it doesn't appear when the defined value is selected. What am I missing?
*using Jira 8.1 + Scriptrunner 5.5.6.1-jira8