Keeping Custom Field Values in Sync Between Parent and Child Issues Using Automation for Jira

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Purpose

For various reasons, you may have a custom field where you want to keep the value in sync between your child issues and parent issues.

In this example, we have a custom field called “Initiative Priority”. The goal is to have the value of this field updated on all child issues when the value is changed on the parent and/or when a new child is created.

Note

This particular example is one way. Updating the parent will update the children but updating the children will not update the parent. However, if a child issue's field is changed, it's value will remain different from the parent until it is overwritten by one of the two rules below executing. For this scenario, it is recommended to make the field read-only for most users on the child issues.

Before You Begin

Before creating the automation rules you’ll need the id of the custom field you wish to keep in sync. To find the ID of a custom field in Jira Cloud, you can follow these steps:

  1. Log in to your Jira Cloud instance with an account that has Jira Administrator permissions.

  2. Click on the Jira Settings cog icon in the top-right corner of the screen.

  3. Select Issues from the dropdown menu.

  4. On the page that appears, click on Custom fields under the Fields section.

  5. Scroll through the list or use the search bar to find your custom field.

  6. When you've found your custom field, click on the three dots (or "more" icon) to the right of the field, and then click on Contexts and default value.

  7. In the URL of the Contexts and default value page, you'll see the ID of your custom field. The URL will look something like this:

https://your-domain.atlassian.net/plugins/servlet/project-config/PROJECTKEY/contexts/customfield_10068

In this example, “customfield_10068” is the ID of the custom field. You can use this ID to refer to the custom field in your automation rules following my example.

Rule 1. Update field value on child issues when the parent is updated

Steps to Create the Rule

  1. Create a new automation rule

    1. Set the trigger to Field Value Changed

    2. Set Fields to monitor for changes to “Initiative Priority”

    3. Set Change type to “Any changes to the field value”

  2. Add an If condition and select {{smart values}} condition

    • Set First value to {{issue.customfield_10068.value}}

    • Set Condition to does not equal

    • Set Second value to Empty

  3. Add a Create variable Action

    1. Set the Variable name to “customval”

    2. Set the Smart value to {{issue.customfield_10068.value}}

  4. Add a Branch rule / related issues branch

    1. Set Type of related issues to “JQL”

    2. Set the JQL field to “parent = {{issue.key}}”

    3. Uncheck the box Only include issues that have changed since the last time this rule executed

  5. Under the branch, create an Edit issue Action

    1. For the custom field in question "Initiative Priority", set the value to be the variable of {{customval}}

Save and publish the rule.

Now, when the value of “Initiative Priority” changes on an issue, the same field on all of that issue’s children will also be updated to the same value.

Rule 2. Update field value on newly created child issues

Steps to Create the Rule

  1. Create a new automation rule
    1. Set the trigger to Issue Created
  2. Add an If condition and select Related issues condition
    1. Set Related issues to Parent
    2. Set Condition to Exists
  3. Add another If condition and select {{smart values}} condition
    1. Set First value to {{issue.parent.customfield_10068}}
    2. Set Condition to does not equal
    3. Set Second value to Empty
  4. Add a Create variable Action
    1. Set the Variable name to “customval”
    2. Set the Smart value to {{issue.parent.customfield_10068}}
  5. Add an Edit issue Action
    1. Set the value of the custom field to be {{customval}}
  6. Add a Branch rule / related issues branch
    1. Set Type of related issues to “JQL”
    2. Set the JQL field to “parent = {{issue.parent.key}}”
    3. Uncheck the box Only include issues that have changed since the last time this rule executed
  7. Under the branch, add an Edit issue Action
    1. Set the value of the custom field to be {{customval}}


Save and publish the rule.

Now, when a new issue is created, a check will be performed to see if the issue has a parent. If it does, the value for Initiative Priority will be pulled from the parent and set for the newly created issue as well as all the "siblings" of that issue.


Last modified on Apr 29, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.