Hello,
Using a ScriptRunner behaviour, I can update the options of a custom field programmatically, based on the value of another field . However there is one problem: I can only see the new options after I close and re-open the same screen (Create).
Is there a way to be able to see the new options right away?
It could also be about the way I update the options. Please see the code below. It clears all previous values and adds new options (fetched from an external web service).
def setCustomFieldOptions(fieldConfig, newItems) {
// delete old list
def optionsManager = ComponentAccessor.getOptionsManager();
optionsManager.removeCustomFieldConfigOptions(fieldConfig);
// populate field options
def newSeqId = 0;
for (String item : newItems) {
optionsManager.createOption(fieldConfig, null, newSeqId++, item);
}
}
Thanks for any help.
Regards