Automation rule to copy a field from a Parent to a Child issue as soon as the Child issue is linked to it

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 purpose of this article is to show how to configure a rule meant to copy the content of a field from a parent issue to a child issue, in the case the parent/child relationship is based on the hierarchy level configuration which is a feature from Advanced Roadmap, and which is dictated by the Parent Link field.

It is important to note that the Parent/Child relationship is different from the Parent/Sub-Task relationship which is documented in configuring sub-tasks. The Copy from parent action in rule Branches can only be used in automation to copy a field from a parent to a sub-task issue. However, it cannot be used to copy the value of a field from a parent to a child issue. This is the reason why implementing such a use case can be a bit tricky, which is why this KB article was written.

Solution

Since there is not action Copy from... available in rule branches that allows to copy the value from a Parent issue to a Child issue, one way to achieve this goal is to configure 2 separate automation rules which are detailed below.

For this solution, we will use the following example:

  • The hierarchy levels are configured so that the Initiative issue type is a parent of the Epic issue type:

Hierarchy levels
  • With such hierarchy level configuration, we will have the Parent/Child relationship described in the examples below:

  • The issue SCRUM-55 is a parent issue of the issue SCRUM-25 (as shown in the Child Issues panel):

Child issues are shown in the below image
  • The issue SCRUM-25 is a child issue of the issue SCRUM-55 (as configured via the Parent Link issue):

    Screenshot showing Parent link

Preliminary steps

  • Before configuring the 2 automation rules, you need to first identify the ID of the Parent Link custom field, since this ID will be different depending on your Jira installation:

    • Login as a Jira system admin user

    • Go to ⚙ > Issues > Custom Fields

    • Search for the Parent Link custom field, and click on... > View

      View parent field
    • Get the ID from the URL: it is the custom field ID that is needed to configure the automation rule:

      Find id of parent link field

Rule configuration 1

The purpose of this rule is to add a new comment to the Parent issue (Initiative type issue) as soon as an Epic issue (child issue) is linked to it via the Parent Link field.

The automation rule will be configured like this:

  • Add the Field Value Change trigger

    • Fields to monitor for changes: Type the string "Parent Link" and press enter. The field will be populated with Parent Link (Match)

  • Add an Issue fields condition with the following settings:

    • Field: Issue type

    • Condition: Equal

    • Value: Epic

  • Add an Advanced compare condition with the following settings:

    • First Value: copy the text below, after replacing XXXXX with the ID of the Parent Link custom field

      1 {{triggerIssue.customfield_XXXXX}}
    • Condition: does not equal

    • Second value: leave it empty

  • Add a Branch rule component with the following settings:

    • Un-tick the option Only include issues that have changed since the last time this rule executed

    • Type of related issues: JQL

    • JQL: There are 2 possible JQL queries that you can use, which both lead to the same result:

      Option 1: enter the JQL query below, after replacing XXXXX with the ID of the Parent Link custom field

      1 key = {{triggerIssue.customfield_XXXXX}}

      Option 2: use the JQL query below

      1 key in parentIssuesOf("{{triggerIssue.key}}")
    • Inside the Branch rule component, add the Comment on issue action with the following settings:

    • Comment: A new Epic issue was added to this parent issue.

  • The rule will look like this (make sure to change 10408 with the actual ID of the Parent Link custom field):

Screenshot of the automation

Rule configuration 2

The purpose of this rule is to copy the content of a field (for example, the "Labels" field) from a Parent issue (of type Initiative) to all the Child issues (issues of type Epic), as soon as the comment "A new Epic issue was added to this parent issue." is added to this issue.

For this 2nd rule, make sure to tick the option Allow rule trigger in the Rule Details page, in order to allow the 1st rule to trigger this 2nd rule. Otherwise, this 2nd rule will not be triggered as expected:

Rule details with Check to allow other rule actions to trigger this rule option checked.

The automation rule will be configured like this:

  • Add the Issue Commented trigger

  • Add an Issue fields condition with the following settings:

    • Field: Issue type

    • Condition: Equal

    • Value: Initiative

  • Add an Advanced compare condition with the following settings:

  • First Value: copy the text below:

    1 {{issue.comments.last}}
  • Condition: equals

  • Second value: copy the text below:

    A new Epic issue was added to this parent issue.

  • Add a Branch rule component with the following settings:

  • Un-tick the option Only include issues that have changed since the last time this rule executed

  • Type of related issues: JQL

  • JQL: enter the JQL query below, after replacing XXXXX with the ID of the Parent Link custom field

"Parent Link" = {{triggerIssue.Key}}
  • Inside the Branch Rule component, add the Edit Issue action with the following settings

    • Choose the field of your choice (for example, "Labels") as the field to update, and select Copy from Trigger Issue

The rule will look like this (make sure to change Labels with the actual field you are trying to copy from the Parent to the Child issue):

Automation rule

Updated on June 13, 2024

Still need help?

The Atlassian Community is here for you.