Steps to Create
1. Add Transition issue(s) post-function
Log into your Jira instance as an Administrator.
In the upper right corner of the window, click Settings ( ⚙️ ) and select Issues.
In the left-hand sidebar, click Workflows.
From the list of Workflows, click the Action button ( ) for the appropriate workflow and select Edit.
Edit the transition:
When viewing the Workflow in Diagram view (Figure 1, right), select the Transition and click the Post Functions link. Click Add post function at the top of the list of existing post functions.
When viewing the Workflow in Text view, click the name of the Transition then select the Post Functions tab. Click Add post function at the top of the list of existing post functions.
Select Transition Issue(s) (JMWE) from the list of post-functions and click Add.
2. Configure the post-function
When using the Transition issue(s) post-function, the target issue will be moved through its workflow based on the post-function configuration. Generally, the post-function can be configured with a prioritized list of transitions to trigger and it will move the issue through the first transition that is appropriate to its current status. In this scenario, the post-function is configured with a single transition - Done - and uses conditional execution to only execute the post-function under very specific circumstances. See Transition issue(s) for more information.
Note: The configuration below has a few pre-requisites in order to function as described.
The parent Story is in a status immediately preceding the Done status, or the transition to Done is available from all other statuses.
The Groovy script included under Conditional execution checks for a status value of “Resolved” to determine if each sub-task is closed. This value will need to match your status value for the Done status.
Set the following configurations:
Transition(s) (Point 1, Figure 2, right)
Set Transition(s) to Trigger one of the following transitions.
Set Transition name or ID to Done, or the appropriate transition to move the issue to a closed status. Click Transition picker to open a window where you can search for a specific transition.
Issue(s) to operate on (Point 2, Figure 2, right) - Set Target issue(s) to Parent issue of the current sub-task.
Options (Point 3, Figure 2, right) - Set as needed.
Transition Screen (Point 4, Figure 2, right) - Set as needed.
If any fields are required to transition the issue, add them here.
In the example (Figure 2, right) the Comment field has static text added to the parent Story -
This issue has been closed because all sub-tasks have been resolved
.Set Comment visibility as needed.
Run As (Point 5, Figure 2, right) - Set as needed.
Conditional execution (Point 6, Figure 2, right) - Enter the following:
Check the box Only if condition is true.
In the Condition field, enter the code:
Delayed execution (Point 6, Figure 2, right) - Set as needed.
Click Add.
3. Publish and Verify
The last step is to publish your updated workflow and then test the new version to verify that the new extensions have been configured correctly. To test the extensions, you’ll need to trigger the same transition to which they were added and verify the results.
Note: it is generally recommended to perform testing in a non-Production environment. After testing is complete, you can migrate your workflow to your Production environment; see this page for steps on exporting and importing your workflow: https://support.atlassian.com/jira-cloud-administration/docs/import-and-export-issue-workflows/.
To publish your updated workflow:
Click Settings ⚙️ and select Issues.
In the left-hand panel, click Workflows.
For the workflow, click Actions and select Edit.
At the top of the workflow editor, click Publish Draft.
With the workflow published, you should test it to verify that the new extensions execute successfully and that the outcome is expected.
You’re done!
Now, when a sub-task is closed, Jira will check the parent issue to determine if it has any remaining sub-tasks that are open. If it does not, the parent issue will be closed!