Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,962
Community Members
 
Community Events
168
Community Groups

Iterating over a variable list in Automation for Jira

Derek Fields Community Leader Sep 05, 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

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

Derek Fields Community Leader Sep 07, 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

Atlassian Community Events