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 !

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 7, 2021

I don't think there is any web-fragment location that you can bind a web panel to in a dialog.

I think the best hack I can think of to add a webpanel-like element on a screen dialog would be to use behaviour and use setHelpText() on the last field in the screen and put your html in the helptext. You would have to override the style to not have the red-color.

There may be limitations as to what html can be inserted there. 

Ajinkya Paradkar
June 30, 2022

Hi Peter , 

 

I have another requirement where , I need to create a shortcut link to "Create Sub-Task" feature in Jira and insert the link in one of the transition screens.

 

Any idea if this can be achieved in Jira or through any third party add ons.

Thanks,

Ajinkya

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 30, 2022

Like my earlier response, you can only do that with behaviour.

Behavior setHelpText and setDescription support full html, so you can post a link.

TAGS
AUG Leaders

Atlassian Community Events