Forums

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

Setting Resolution Value on Transition

Brian Taylor
Contributor
September 4, 2018

I have a scriptrunner behavior that sets the values based on transition but want to have the default value "null" so that it says to select a value then have the values I have defined 

import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION

if (getActionName() == "Cancel Request") {
def constantsManager = ComponentAccessor.constantsManager
def allowedResolutions = constantsManager.resolutions.findAll {
it.name in ["Won't Do", "Duplicate", "Cannot Reproduce", "Cancelled", "Won't Fix", "Incomplete" ]
}

getFieldById(RESOLUTION).setFieldOptions(allowedResolutions)
}

 Scriptrunner-1.png

1 answer

1 accepted

0 votes
Answer accepted
Mark Markov
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 Leaders.
September 5, 2018

Hello @Brian Taylor

First of all, you can do it without behaviour with jira properties on transiotion.

Check this article

If you need do it with behaviour you can try add null value in list

import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION

if (getActionName() == "Cancel Request") {
def constantsManager = ComponentAccessor.constantsManager
def allowedResolutions = constantsManager.resolutions.findAll {
it.name in ["Won't Do", "Duplicate", "Cannot Reproduce", "Cancelled", "Won't Fix", "Incomplete", null]
}

getFieldById(RESOLUTION).setFieldOptions(allowedResolutions)
}
Brian Taylor
Contributor
September 5, 2018

I appreciate the feedback and did think of using the properties as an option - but do not want to have to go to each workflow if a change is required 

I tried adding null as suggested and it does not address the issue 

Brian Taylor
Contributor
September 7, 2018

I received confirmation from Adaptavist that Behaviors cannot have a Blank value in the behavior script - so the only way to limit the select is through the properties - thanks for the help

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events