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

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

 

This is an example rule. Creating rules to meet specific requirement is outside of Atlassian Support Scope. These example are for reference only and not prescriptive.

Every Environment is different and so is every requirement. Our intention here is to share what we learned along the way. Even if you cannot use the rule exactly described, we hope the concepts should be helpful in designing your own Automation rules.

Automation for Jira is a powerful tool. We expect you to follow your organisational Change Management policies. Please test before implementing on production environment.

Purpose:

  • 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 #1Rule #2
  • Trigger when Issue Type A Created
  • (if-else) Depending on the Issue Type (action) create subtasks of your choice 
  • (lightbulb)Make sure to check the button (tick) Check to allow other rule actions to trigger this rule (This is to make sure Rule #2 can trigger this rule)
  • Trigger on Issue transition to "Done"
  • (if-else) Depending on the Issue Type 
    • (branch) for subtasks, close them
    • (lightbulb)Please make sure the subtask workflow has an "All → Done" transition
  • (action) Create a new issue of Issue Type B (This would trigger Rule #1 and create the subtasks)

Last modified on Jun 1, 2022

Was this helpful?

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