Hi there!
I'm trying to figure out of what's wrong with my Behaviours script.
The main idea is that I have my single select field with three options and I would like to manipulate other field(s) depending of these options.
But I faced with a strange thing - I can set different options for other field (in case AAA and BBB) and I can hide it, but it doesn't become visible again.
So, here is my script for the custom single select field:
import com.atlassian.jira.component.ComponentAccessor
def singleSelect = getFieldById(getFieldChanged())
def optionsManager = ComponentAccessor.getOptionsManager()
def cf = getFieldById("customfield_16113")
def cfField = customFieldManager.getCustomFieldObject(cf.getFieldId())
def cfConfig = cfField.getRelevantConfig(getIssueContext())
def cfOptions = optionsManager.getOptions(cfConfig)
cf.setHidden(false)
def selectedOption = singleSelect.getValue() as String
def ccc = selectedOption == "CCC"
switch (selectedOption) {
case "AAA":
def cfA = cfOptions.findAll { it.value in ["A","B","C","D"] }.collectEntries { [ (it.optionId.toString()) : it.value ] }
cf.setFieldOptions(cfA)
break
case "BBB":
def cfB = cfOptions.findAll { it.value in ["B","D","H","K"] }.collectEntries { [ (it.optionId.toString()) : it.value ] }
cf.setFieldOptions(cfB)
break
case "CCC":
cf.setHidden(true)
break
}
cf.setRequired(! ccc)
In general I would like to show different sets of options for my customfield depending on value of singleSelect field and hide customfield at all in the last case. But the issue is that after hiding it doesn't become visible again if I change the value of singleSelect field.
Is that something connected to the issue / field context?
Please point me to the documentation or something.
Thanks,