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

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,782 views 11 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot