Hi,
I've created a built-in listener "Fast-track transition an issue" with scriptrunner plugin from Adaptavist
The event is fired properly, the transition is executed and some post-functions are also executed.
One of this post function is to update a custom field (a select-list one).
I've copied the "Set select list custom field" snippet" which is :
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("Some Select List") // name of CF
def optionsManager = ComponentAccessor.getOptionsManager()
def fieldConfig = customField.getRelevantConfig(issue)
def option = optionsManager.getOptions(fieldConfig).find { it.value == "Yes" } // value of option
issueInputParameters.addCustomFieldValue(customField.id, option.optionId as String)
issueInputParameters.setSkipScreenCheck(true)
The code analysis sets a warning on the customFieldManager definition, saying "Variable "customFieldManager" masks a binding variable. Please choose a different name for variable: "customFieldManager" @ line 8, column 5.
I've several listeners configured the same way (but with different custom fields...all select-list). Some works, some don't...
I'm new with scriptrunner so I may have missed something...but I would exect built-in snippets to work from scratch....
If someone from Adaptavist could help, this would be great !