Automation For Jira - How to clear the Parent Link field when an issue is moved to a new type
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Context behind this article
Advanced Roadmaps is an application which comes with some custom fields such as Team, Parent Link, Target Start, Target End...
The Parent Link field is used to link issues together based on the hierarchy configured for Advanced Roadmap. For example, if the Epic issue type is ranked underneath the Initiative issue type, then Epic issues can be linked to Initiative issues via the Parent Link field, and the Epic issue will be considered as a child of the linked initiative.
Issue
When issues that already have a parent link are moved to a new issue type (that belongs to a different level in the hierarchy), the Parent Link field remains untouched, which causes data discrepancy since the hierarchy levels are no longer respected.
For example:
- let's assume that the hierarchy is configured with the following order: Initiative > Epic > Story
- let's assume that issue ABC-111 is an Epic issue which is linked to the parent ABC-222 which is an Initiative issue
- if the issue ABC-111 is moved to a new type such as a Story, the Parent Link will not be cleared, and will still point to the Initiative issue ABC-222
- this will cause data discrepancy, since Story issues cannot be directly linked to Initiative issues
This issue is a known feature limitation, which is tracked in the open suggestion ticket linked below:
- JPOSERVER-2059Getting issue details... STATUS
Purpose of this article
The purpose of this knowledge article is to provide a way to automatically clear the Parent Link field whenever an issue is moved to a new issue type within a given project, and therefore prevent any possible data discrepancy.
Note that this solution requires the Automation For Jira application, which has been bundled in Jira since the version 9.0.0 (but which can also be manually installed in Jira 8.x versions).
Environment
- Jira Server / Data Center on any version from 8.0.0
- Automation For Jira on any version from 7.4.0
Solution
The solution consists in 2 main steps.
Step 1 - Identify the ID of the Parent Link custom field
Let's identify the custom field ID of the Parent Link field ( this ID will be different in each Jira installation) by following the steps below:
- Go to the page ⚙ > Issues > Custom Fields
- Search for Parent Link
- Click on ... > View next to the field
- Pickup the ID at the end of the URL (this is the custom field ID), as shown in the example below:
Step 2 - Create the automation rule
Now it's time to create the automation rule. Note that you can:
- either create the automation rule at the global level via the page ⚙ > System > Automation rules
- or create the automation rule at the project:
- For Jira 8.x, via the page Project Settings > Project Automation
- For Jira 9.x, via the page Project Settings > Automation
Automation rule configuration:
- WHEN: Field value changed
- Field to monitor: Issue Type
- For: All issue operations
- IF: Advanced compare condition
First Value: Past the content below, after replacing XXXXX with the custom field ID found earlier:
{{triggerIssue.customfield_XXXXX}}
- Condition: does not equal
- Second value: Empty
- THEN: Edit issue
Do no select any field, and instead paste the content below in the Additional fields box, after replacing XXXXX with the custom field ID found earlier:
{ "fields": { "customfield_XXXXX":"" } }
Full Automation Rule configuration