All Sub-tasks Resolved Condition
Use the All sub-tasks must be resolved built-in condition to stop/hide a transition in a parent issue until all sub-tasks are set to a chosen resolution. For example, you can use this script to make sure a parent task cannot be transitioned to the Done status until all sub-tasks have a resolution of Done.
It is important to remember that a resolution is different from a status. The resolution is typically automatically set using a post function when an issue is transitioned to a specific status. For example, when you transition an issue to the Done status, the resolution typically updates to Done with a pre-generated post function.
For this condition to work, you must ensure the Resolution automatically sets to the required state using a post function. This post function is usually pre-generated in most workflows; see the Jira Knowledge Base article on Resolutions for more information.
Use this condition
- Go to Administration > Issues > Workflows.
- Select Edit on the workflow you want to add a condition to.
- Select the transition to which you wish to add a condition.
- Under Options, select Conditions.
- On the Transition page, select Add condition.
- Select All sub-tasks must be resolved [ScriptRunner].
- Select Add.
- Optional: Enter a note that describes the condition.
- Select a resolution. This is the resolution you wish sub-tasks to have before the parent issue is permitted to transition.
- Select Preview to see an overview of the change.
Select Update.
Select Publish and choose if you want to save a backup copy of the workflow.
You can now test to see if this workflow condition works.
Additional example
If you would like to be more specific about which sub-tasks must be resolved before a parent transition is permitted, you can use a simple scripted condition. For example, check out the Conditions tutorial page for an example where All QA sub-tasks must be resolved.