Hello world,
i've set up a behaviour for two option lists. Depending on the option in the select list "Strategic objective" the select list "Initiatives" shows corresponding options. My script works, but the select list (Inititatives) updates by clicking the list. How can I set up my code to get the list updated whenever a option is selected in the list "Strategic objectives" - on-action.
my code:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def strategicObj = getFieldByName("Strategic Objective")
def initiative = getFieldByName("Initiative")
def customField = customFieldManager.getCustomFieldObject(formField.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def strategicValue = strategicObj.getValue();
if (strategicValue == "1 - Example")
{
def optionsMap = options.findAll {
it.value in ["1.1 - XXX",
"1.2 - XXX",
"1.3 - XXX",
"1.4 - XXX",
"1.5 - XXX"] // list of options
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
initiative.setFieldOptions(optionsMap)
initiative.setRequired(false)
initiative.setHidden(false)
}
else if (strategicValue == "2 - Operative Exzellenz steigern")
{
def optionsMap = options.findAll {
it.value in ["2.1 - YYY",
"2.2 - YYY",
"2.3 - YYY",
"2.4 - YYY"]
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
initiative.setFieldOptions(optionsMap)
initiative.setRequired(false)
initiative.setHidden(false)
}
kr,
vedat