Automation rule to fetch the parent's parent issue key on the current issue
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Currently, we've an option to display the parent of an issue in the issue view, but not the parent's parent. This automation rule is devised to copy the summary/key of the parent's parent issue to a custom field in the current issue.
Environment
Jira Cloud
Solution
Consider the Issue type hierarchy is configured as below and the requirement is to show the Initiative issue key(Level 2) on the Story issue's custom field(type short text).
Pre-requisite: Create a custom field of type Short text and add it to the screens associated with the Story issue type.
Automation Rule Configuration:
Trigger: Choose the trigger as per your requirement.
Condition: Add a condition to check issue types if required
Select Add a condition and then IF or ELSE: Add condition options
Select Related issues condition and choose Parent under Related issues and Exists as the condition
Use action Create Variable, call it superparent and set the value to NULL. Variable is created here so it can be used in the Branch created in the next steps and also outside the branch.
Please refer to Automation for Jira - Create variable (New component) to learn more about this action.
Select Add a branch, Branch rule / related issues choose Parent under Type of related issues.
Create Variable with the same name as before and use one of the below smart values to store the Initiative issue summary/key
{{issue.parent.summary}} - to get the summary of the parent issue
OR
{{issue.parent.key}} - to get the key of the parent issue
Outside the branch, choose Add an action, Edit issue, select the custom field created and use the below smart value to populate the Initiative issue key
{{superparent}}