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.
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 ?
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.
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.
The script is simply:
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:
Expecting the "Done" button to not show up. It didn't show up.
Then I changed the condition script to:
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.
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.
The key points are:
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event