Automation for Jira | How to trigger a rule when a Sub-task's Parent changes (sub-task is moved)?

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

This guide explains how to run an Automation for Jira (A4J) Server/Data Center rule when a sub-task moves from one parent to another. For example,

  • Story A

    • Subtask A

  • Story B

    • (Subtask A moved here)

Solution

In A4J, the "sub-task moved parent issues" event is Issue Edited. The way we can track the sub-task moved is via the changelog Smart Value

Therefore, we can create a rule as follows:

Sample rule
  • When: Issue updated

    • This is the trigger for "sub-task moved"

  • If: Issue Type equals "sub-task"

    • Check if the sub-task issue type triggered the rule

  • And: Advanced compare condition:

    • Check if:

      • {{changelog.Parent Issue.fromString}}

    • Does not equal:

      • {{changelog.Parent Issue.toString}}

    • This uses the change log smart value to check the "Parent Issue" change log entry and compare the "from" and "to" strings. If it does not match, then we know that the Sub-task has moved.

  • (example) Then: Add comment to the issue

    • You can reference the smart values for issue.key (subtask that got moved), changelog.Parent Issue.fromString (original parent) and changelog.Parent Issue.toString (new parent)

Updated on August 22, 2024

Still need help?

The Atlassian Community is here for you.