Hi there,
in JIRA, we like to implement a group picker (single choice) in order to define the responsible development group for a new feature out of a small list stored in the internal user directory.
Instead of defining validators for every workflow steps (at least 2 different workflows are affected) we thought about using global Behaviours (Scriptrunner add-on). After checking the documentation, I tried this validator script for the according customfield, mapped to all projects and issue types:
import com.atlassian.jira.component.ComponentAccessor
def respDevTeamFld = getFieldByName("Responsible Development Team")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(respDevTeamFld.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsToSelect = options.findAll { it.value in ["Option 1", "Option 2", "..."] }
respDevTeamFld.setFormValue(optionsToSelect*.optionId)
Unfortunatelty, it does not work. The user picker for the customfield "Responsible Development Team" is not restricted to the defined values. The user is still able to select any group stored in the internal user directory.
Do you have any idea what is wrong?