A4J Rule: cyclical automation - creating issuetype A should create subtasks and closing issuetype A should close subtasks and create issuetypeB

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 cyclic automation rule requirement is

  • When an issue of Issue Type A is created - it should automatically create a bunch of subtasks.

  • When that issue of Issue Type A is closed - it should close the existing subtasks under it and also create another issue of Issue Type B

  • This newly created Issue Type B should also create a bunch of subtasks under it - and so on.

Solution

In summary the approach could be:

  • We need two separate rules for the use case because the whole framework has two triggers (i.e., issue type created and issue type closed)

  • We can keep Rule #1 for creating the subtasks when a certain issue type is created

  • We need Rule #2 to be triggered on a parent issue type closure and to create a new parent issue type

  • The Rule #2 action of creating the new parent issue type would trigger the first rule again (cyclical)

    • The trick is to check the "Check to allow other rule actions to trigger this rule" for Rule #1 so that the sub-task creation rule can be triggered by the closure rule

Rule #1

Rule #2

1. Trigger when Issue Type A Created

2. (if-else) Depending on the Issue Type (action) create subtasks of your choice

3. Make sure to check the button "Check to allow other rule actions to trigger this rule" (This is to make sure Rule #2 can trigger this rule)

1. Trigger on Issue transition to "Done"

2. (if-else) Depending on the Issue Type - (branch) for subtasks, close them - Please make sure the subtask workflow has an "All → Done" transition

3. (action) Create a new issue of Issue Type B (This would trigger Rule #1 and create the subtasks)

Refer to the below screenshots for both Rule #1 and Rule #2

Rule #1
Rule #2

Updated on May 31, 2024

Still need help?

The Atlassian Community is here for you.