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:
Code Block language none
linkedIssue.subtasks.stream().allMatch { it.status.name == 'Done' }
Error Handling (Point 7, Figure 2, right) - Set as needed.
Click Add.
3. Publish and Verify
Include Page | ||||
---|---|---|---|---|
|
Panel | ||
---|---|---|
| ||
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! |