Automation rule|Looping on a Numeric value in Jira Automation
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
As a user, I would like to create an automation that creates subtasks based on a number in a custom field like the one shown in the screenshot below:
Environment
Jira Cloud
Diagnosis
Using the Advanced Branching alone in an automation rule only creates one task
Cause
Jira's native automation capabilities do not directly support looping based on numeric conditions
Solution
Trigger
Use any trigger you want. In this example, we will use a manual trigger
Create lookup table
The purpose of the lookup table (tabCustom) is to map the numeric value of the custom field (Support number, in this case) to nominal values that can be looped over by the automation rule. If the custom field is a number field, add a decimal point like this:
If the custom field is a text field, you don't need to add the decimal point:
Advanced branching
The branch is used by the automation rule to loop over the values of the Lookup Table. To be able to loop over the values, we used a split function to separate the values into individual entities:
{{tabCustom.get(Support Field).split(", ")}}
This is shown in the screenshot below:
Create sub-tasks
Finally, create the subtasks inside the branch and add any fields you want:
Output
The images below show the output after executing the rule
The Audit Log
Created Subtasks:
Performance Warning
Please note that this solution is useful for a limited number of subtasks. Performance degradation increases proportionally to the number of subtasks created.