I have a subtask issue CM Review that needs to be set to Done before the parent issue 'Change Request' ticket can move to the next status 'SME Review'. Does anyone know what simple script I can write to achieve this?
Parent issue cannot move to 'SME Review' until sub-task issue is 'Done'. Other than that user will get an error message.
You can definitely achieve this behavior, but instead of writing a custom script, I’d recommend a more reliable and scalable solution using a checklist validator. If you try Smart Checklist for Jira, you can solve this elegantly by replacing the sub-task with a mandatory checklist item and then applying our Smart Checklist validator to block status transitions until the checklist item is completed.
Smart Checklist offers a built-in workflow validator that checks whether all mandatory items in the checklist are marked as Done before allowing a transition. If any item is still open, the transition (e.g. from "Change Request" to "SME Review") will be blocked and an error message will appear.
This method ensures:
Sub-task logic is simplified into a checklist
Transitions are only allowed when required checklist items are completed
Admins can enforce immutability and control over what’s required
Just to add to what @Trudy Claspill describes above. You can add a condition directly in the workflow that all Sub-task needs to have a certain status before allowing the transition.
The drawback is that the user don't get any error message, the transition is just unavailable until the conditions are met which might cofuse users.
Let me know if this is of any help!
Best regards,
/Staffan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried this option, however it will hide the transition from the user which is something I do not want in the process. And it would be a nice to have an error message appear.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Mahnoor Arshad
You mentioned that you are looking for a script. What apps do you have added to your Jira instance that supports adding scripts?
Without scripting tools, one possible solution is to have a custom field in the parent issue that is set only when the subtask is transitioned to Done. You could use an Automation Rule, triggered by the transition of the subtask, to set the field in the parent issue.
You could then add a Validator to the workflow transition for the parent to the SME Review status to check the content of that custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have Scriptrunner. I have written a simple scripted validator to help achieve this however it does not seem to be executing properly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Mahnoor Arshad
Thank you for that additional information.
The tags on your post indicate that this question concerns Jira Cloud.
Can you confirm that this is for Jira Cloud versus Jira Data Center? The screen I have in my Jira Cloud instance for adding a ScriptRunner Scripted Validator to a workflow does not look like the image you provided.
Notice that mine has the field for the message above the scripting area.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mahnoor Arshad .
Thank you for your question. Please consider the following doc from Adaptavist: https://docs.adaptavist.com/sr4jc/latest/features/workflow-extensions/jira-expression-examples with Jira expressions and groovy script.
Other way is to "revert" the status through automation, but after have changed the status.
Hope it helps
Regards
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.