Automation for Jira - how to trigger a rule when a Sub-task's Parent changes (sub-task is moved)
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
目的
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)
環境
- 8.0.0 以降の任意のバージョンの Jira Server/Data Center
- Automation for Jira バージョン 7.0.0 以降
ソリューション
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:
- 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.
- Check if:
- (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)