Hello,
I'd like some assistance with creating a script so that I can use Scriptrunner as a 'validator' within a workflow transition to 'Done', where it parses the issue's subtasks to check if all of them are in a 'Done' state.
I'd also like to return an error message saying "Please ensure sub-tasks are complete before transitioning.", which I know can be done in the Validator side.
I am currently using the 'Condition' for sub-task state which currently works as a v1 fix, but we'd like to have that error message which seems to be reserved for 'Validators'.
I don't have much scripting experience, and could use some help with this please if it's possible!
Thank you,
Justin
You can't provide an error message with a Condition because the Condition determines whether the transition can be executed at all. If you don't meet all of the conditions, the transition is not available.
An example of a script that would prevent you from executing the transition if any sub-tasks do not have a status of Closed would look like this (note that this is for Data Center, not Cloud)
If you don't have scripting experience and prefer wizzard-like validator/condition, take a look at Linked Issues Validator which is part of the free Workflow Building Blocks for Jira app.
1. Add validator to the transition
2. Set Relation to Sub-tasks
3. In Status category: select Done
This validator comes with a default validation message, wich in this case will be:
"If there are sub-tasks. All of them must be in the status category: 'Done'."
If that message is not sufficient for your needs, copy the generated expression and use the Jira Expression Validator (also part of Workflow Building Blocks for Jira). Paste the expression and provide your validation message.
Full disclosure: I am from Forgappify, the vendor of the app.
I would appreciate it if you could give it a try.
Cheers
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.