Automation For Jira - How to clear the Parent Link field when an issue is moved to a new type

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

The 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 links issues together based on the hierarchy configured for the 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 a child of the linked initiative.

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 can't be directly linked to Initiative issues

This issue is a known feature limitation, which is tracked in the open suggestion ticket linked: JSWSERVER-24811

Solution

The solution consists of 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:

    Find id of parent link field

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 for 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 not select any field, and instead paste the content below in the Additional fields box, after replacing XXXXX with the custom field ID found earlier:

      1 2 3 4 5 { "fields": { "customfield_XXXXX":"" } }

Full Automation rule :

Clear parent link when issue type is changed

Updated on June 6, 2024

Still need help?

The Atlassian Community is here for you.