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 Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

792 views 2 19
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