Hello,
We have a Behavior (scriptrunner) that shows only certain values in a select list field when certain other values are chosen in a different select list field:
Here is the script:
def RespProject = getFieldByName("Responsible Project")
def AgileTeam = getFieldByName("Agile Team")
def customField = customFieldManager.getCustomFieldObject(AgileTeam.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
if (RespProject.getValue() as String == "FC Audio") {
def optionsMap = options.findAll {
it.value in ["VSP", "VST", "Aud_Decibels", "None"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
AgileTeam.setFieldOptions(optionsMap)
}
else if (RespProject.getValue() as String == "FC Connectivity") {
def optionsMap = options.findAll {
it.value in ["DCON_Fermi", "None"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}
AgileTeam.setFieldOptions(optionsMap)
}
However, I cannot make it still allow the selection of the "None" option. It automatically selects the first value in the list, and sometimes we just want to have a value selected in "Responsible project", but the "Agile Team" can still be empty, until an analysis is made.
Thank you!