Hello!
I am trying to implement a script that adjusts the visibility of a few fields base on the selection of another single select dropdown field. Tried different methods found online and from the atlassian community responses to other similar questions, but fields do not hide from the start, and cannot tell if rest of code works without that. At least attach code to a field. Initializer works for hiding the fields, but not conditional stuff like re-appearing them with a selection.
What I have presently:
def impactField = getFieldById("customfield_15890")
def severityField = getFieldById(getFieldChanged())
def selectedOption = severityField.getValue() as String
def isImprovementSelected = selectedOption == "Improvement"
impactField.setHidden(! isImprovementSelected)
impactField.setRequired(isImprovementSelected)I've tried basing on this https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html#undefined which does work, but this method does not work with customfields it seems.
Most I can guess as causes is forgetting a syntax, or import declaration, or something to do with custom fields. Suggestions? Ideas? Example somewhere using customfields instead?
Thank you!
Melanie