Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

scriptrunner listener issue with the post function snippets

Stéphane Blondeau
September 3, 2020

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 !

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events