Iterating over a variable list in Automation for Jira

C_ Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2022

Is there a way to iterate (loop) in A4J? I want to create a set of sub-tasks, but the number of sub-tasks will be determined from the parent. Simple example - the Requester enters a number (say 4) and my rule will create 4 sub-tasks. 

Any thoughts on how to accomplish this?

1 answer

0 votes
Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2022

You can read a field value and go with If statements (if value == 4 - create 4 subtasks etc) but the rule will be long and will take some time to execute

C_ Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 7, 2022

It doesn't really help if the number is variable and potentially large. The range in this case could be 1-30. I really need a "while" or "for" loop kind of mechanism. One idea that I have is to create a list of issues in a dummy project with an id of 1 to 30 (or 100 or whatever). Then I could do a JQL Branch "project = XXX and id <= {{issue.number of subtasks}}" - this would return the correct number of issues and let me iterate that way. It is a real kludge though

What I ended up doing instead is using JMWE and the range() function to do it.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events