what i want is only user in "SWTL" project role can select except "Fixed" as resolution(like "Reject","Incomple"...), and all sw developers can select "Fixed" as resolution
so i add a script validator as below
isUserMemberOfRole('SWTL') && issue.resolution?.name != 'Fixed'
but the result is strange.
1 one user is of "SWTL" role ,and when choose Fixed,it prevents,but when choose not "Fixed" like "Reject" or "Incomplete" or others. it's ok.
2 if the user is not of "SWTL" role,no matter what resolution he choose,it prevents.
anyone can tell how to write the script condition in "Validators"
A validator can be thought of as a simple logical question. If the answer is yes, it passes, if the answer is no, it fails.
Your logic says "if the user is a member of the group SWTL and resolution is not fixed". If you think about that carefully, what you're saying is that the person MUST be a member of the group SWTL and the resolution must be something other than fixed. It's the first clause that's killing the other users because they're not in the group...
I think what you need is more like
If (user is member of the SWTL group and resolution != fixed) OR (user is NOT member of SWTL group)
i wrote the script:
isUserMemberOfRole('SWTL') || (! isUserMemberOfRole('SWTL') && issue.resolution?.name == 'Fixed')
and it works!
Nic do you know some examples about this kind of script,i want to know the syntax of this script.
because i even don't what type of this script,
I don't actually know. I have a strong suspicion that you have the script runner plugin installed, because on a standard Jira, you can't just whack in odd lines of code like that. See https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner
Check that, and if it is what you're using, then the docs for it have loads of examples...
Try Workflow PowerBox plugin and its validator templates. They allow to do grouped validators (like conditions). If you use "Run condition as validator" Validator and "Universal Issue Field Value Validator (including history)" you can reach your goal without scrpting
Here is link to documentation: https://coresoftlabs.atlassian.net/wiki/display/WPB/Product+Overview
As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot