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

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

This widget could not be displayed.

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

Thank you for the answer. This works perfectly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

203 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you