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)
thanks Nic,
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suspect Nic is right because isUserMemberOfRole is a closure only defined in the script runner plugin afaik. The syntax is groovy, more or less a superset of java, which you can find tutorials for all over the web.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.