Using the example workflow, I am trying to setup a validator.
I expect this validator to make all transition from To Do to Done impossible. Then I go to an issue at "To Do", and click "Done" button... but it failed to block the action. The issue changed from "To Do" to "Done" successfully.
I tried setting the field ID to "status" and changing the script to return error message, "return "Banned";", but it also doesn't work.
What am I missing?
Hi @KC Wong I agree with Dave's response. You can remove the transtion from To Do >> Done , instead of applying a validator.
If you don't want to remove transtion you can apply a condition that Done won't visible until all condition are met.
Or
You can try to apply a transtion screen on Done status, so that validator gives an error message on transition screen, as some validator won't works without transition screen.
On which scenario you want to allow Done transtion from To Do ?
Thanks
V.Y
HI @KC Wong welcome to the Atlassian Community!
If I understand your problem correctly, you would like people to prevent to move an issue from status To Do to Done, right?
When you remove the global transition All -> Done and add a transition from In Progress to Done, then people are only allowed to move an issue to Done when it's In Progress.
Is that what you would like to achieve? If not, please explain in more detail.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm trying to figure out how to use a validator, blocking To Do -> Done isn't my real objective.
I tried to setup a validator to block To Do -> Done, using a script to return false or an error message unconditionally, but it is not working at all, I can still change an issue from To Do -> Done.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you share the Groovy script you've used? I won't be able to help you debugging the script, but I'm sure fellow community members can help you sort things out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script is simply:
return false;
So that all attempts to click "Done" from "To Do" will be blocked by the validator.
But all issues can go from "To Do" to "Done" successfully.
I also tried to configure a condition. The sample has a condition to check Resolve Issue access rights, I removed it and put an insight script:
return false;
Expecting the "Done" button to not show up. It didn't show up.
Then I changed the condition script to:
return true;
And the "Done" button still does not show up. I also tried return null to no avail.
There is something about these Insight scripts that I seriously do not get.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now I realize "Insight" is a different thing entirely. So I installed Script Runner and used it as the validator instead:
But it still doesn't work. It does not block moving from To Do -> Done at all. I tried throwing an Exception in the script, then Script Runner logged it as a fail, but the transition from To Do -> Done is still successful.
What is the expected behavior of a validator script? Isn't it expecting a String (error message) or boolean in return value?
Script Runner's documentation: https://scriptrunner.adaptavist.com/latest/jira/tutorials/scripted-validators-tutorial.html says there should be an option "Script Validator [ScriptRunner]"
But I see these instead:
Custom script is the one I used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally, success.
The key points are:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.