How to automatically transition an Issue to a Closed status when all Linked Issues are Closed
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
In this guide, we will explain how to configure a Jira automation rule to automatically transition an issue to a "Closed" status once all of its linked issues are closed.
Solution
Let's say we have an issue, ITSM-100, with linked issues, ITSM-101 and ITSM-102. We want ITSM-100 to close automatically only when both ITSM-101 and ITSM-102 are closed.
To achieve this, we will use Automation for Jira.
Step 1: Set Up the Automation Rule with a Trigger
Create a new automation rule in Jira.
Select the trigger: "Issue transitioned" for an issue transitioned to "Resolved."
This trigger ensures that the rule activates whenever a linked issue transitions to the "Resolved" status. (Note: You can choose a different status based on your workflow.)
The following steps will evaluate if all linked issues are Resolved.
Step 2: Create a Branch Rule for Linked Issues
Add a branch rule: Select "Branch rule / related issues" and choose "Linked issues".
Specify the link types if required.
This step will allow actions to be performed on the main issue (e.g., ITSM-100) that is linked to the issues transitioning to "Resolved" (e.g., ITSM-101 or ITSM-102)
Step 3: Use a 'Lookup Issues' Action
- Add a 'Lookup issues' action using the following JQL query:
issue IN linkedIssues("{{issue.key}}") and status != Resolved
This JQL query checks if there are any linked issues to the main issue that are not yet resolved. You can adjust the JQL to fit your specific requirements.
Step 4: Add a Conditional Check
Check the results from the 'Lookup issues' action:
Use a condition to verify if
{{lookupIssues.size}}
equals 0.
If all linked issues are resolved, the JQL query will not return any results, making {{lookupIssues.size}}
equal to 0. This condition allows the rule to proceed to the next step to close the main issue.
Step 5: Transition the Main Issue
Transition the main issue (e.g., ITSM-100) to "Resolved":
This action is executed only if the condition from Step 4 is met (i.e., all linked issues are resolved).
If the JQL query does return any unresolved issues, {{lookupIssues.size}}
will not be 0, and the condition will fail, preventing the transition of the main issue to "Resolved."
Additional Options
Add more conditions or actions: You can include additional checks, such as verifying the Request type or setting the Resolution field, to tailor the rule to your specific requirements.
By following these steps, you can automate the process of closing a primary issue when all its linked issues are resolved, improving efficiency and ensuring consistency in your issue management process.