Automation For Jira - How to write a rule to close a parent issue after all sub-tasks have been closed
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When a parent issue (for example Task/Bug/Story type issue...) has sub-tasks underneath it, we might want to automatically close it once all the sub-tasks have been closed.
The purpose of this article is to provide a way to configure an automation rule that will automatically close the parent issue, once the last sub-task was closed.
Solution
Automation rule configuration
Add an Issue Transitioned trigger with the parameters below:
From Status: leave empty
To Status: choose the workflow status that issues enter when they are closed/done. For example: the status DONE
Add an Issue Field Condition with the parameters below:
Field: Issue Type
Condition: Equals
Value: Sub-task
Add a Branch Rule with the parameter below:
Type of related Issues: Parent
Inside the Branch Rule, add the 2 components below:
Add a Related Issues Condition with the parameters below:
Related Issues: Sub-tasks
Condition: "All match specified JQL"
Matching JQL: "status = DONE"
Make sure to change the status to the one used in the workflow when an issue is closed (for example: Closed, Resolved, etc...)
Add a Transition Issue action with the parameters below:
Transition the issue by: "Selecting the destination status"
Destination status: DONE
Make sure to change the status to the one used in the workflow when an issue is closed (for example: Closed, Resolved, etc...)
Screenshot of the automation rule
Was this helpful?