Jira: How to Restrict Resolution options according to transition being performed

Martin Burton December 6, 2013

Hi,

We have a need to restrict the options available for the resolution field accrding to the action being performed. E.g. we have an action "Close - no fix", for which the options are "Functions as Designed", "Won't Fix", "Cannot reproduce". Other actions allow values such as "Fixed" etc.

In our Jira 4.0.1 instance this is implemented using javascript code in the description of the Resolution field as follows:

if (document.location.href.match(/.*CommentAssignIssue.*/)) {
res_box = document.getElementById('resolution');
if (document.location.href.match(/.*action=121(\D|$).*/)) {
removeAllOptions(res_box);
addOption(res_box, "Fixed", 1);
} else if (document.location.href.match(/.*action=41(\D|$).*/)) {
removeAllOptions(res_box);
addOption(res_box, "Functions as Designed", 7);
addOption(res_box, "Cannot Reproduce", 5);
addOption(res_box, "Won't Fix", 2);
}

}

function removeAllOptions(selectbox) {
var i;
for(i=selectbox.options.length-1;i>=0;i--) {
selectbox.remove(i);
}
}

function addOption(selectbox,text,value ) {
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

The complete script has been reduced here for brevity.

We are in the process of upgrading our Jira system to a later version and have found this no longer works (I have tried in Jira 5.0 & 6.0). Please could somebody suggest how to implement this in 5.0 or later.

Thanks,

Martin.

1 answer

1 accepted

17 votes
Answer accepted
RambanamP
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.
December 6, 2013

you can restrict the resolution option by using workflow properties,

add the following propety on transition properties as key values

jira.field.resolution.include =1,2,3

1,2,3 is the id's of the resolutions

check this doc

https://confluence.atlassian.com/display/JIRA/Workflow+properties

and also @jobin explained well about workflow properties here

http://www.j-tricks.com/1/post/2011/02/permissions-based-on-workflow-status.html

Martin Burton December 7, 2013

Thank you for the answer. This works perfectly.

Like # people like this

Suggest an answer

Log in or Sign up to answer