Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,559,480
Community Members
 
Community Events
184
Community Groups

Ability to iterate / loop an JIRA automation rule to create N number of sub-tasks

Hi Experts!

I'm currently trying to create a rule using JIRA service management automation to create an N number of subtasks when an issue transitions from one state to another.

My problem is as follows:

  • My trigger issue has two date fields: Start Date and End date
  • If the difference between the Start Date and the End date is considered as N number of business days;
  • Then I need to create N number of subtasks under the trigger issue; one sub-task per each business day. 

Is there a way to create a number of subtasks dynamically based on a value defined in any custom field/variable?

Any help, advice, direction would be greatly appreciated please?

 

3 answers

2 accepted

1 vote
Answer accepted
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 12, 2022

Hi @Nuwanee Nadeesha 

There isn't a simple way to do what you want. The only feature that Atlassian provides us with Jira Automation is to "branch" using a custom variable list. And this has to be a list!

With that said the only list I can think of and could do that trick for you is a multi select checkbox. In theory this should work:

  • Create a checkbox field with XX values (let's hope that you will not need more that 30-31)
  • Create a rule
  • Calculate the date difference you want (hopefully less that 30-31)
  • Using If/Else pass the difference to the CF
    • if you have e.g. a diff of 10 days, then ALL values from 1 to 10 must be selected
  • Once you done this branch using a custom variable
  • As a list, you place the values of the above field
  • As an internal component you place a create subtask under the trigger issue

It's not the best approach, but it's the only thing you've currently got. I would recommend getting an app like JMWE and do everything from there. Better :)

Hi @Alex Koxaras _Relational_

Thanks for the valuable feedback, I'll try out your workaround and hopefully revert with some results.

1 vote
Answer accepted
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 11, 2022 • edited

@Nuwanee Nadeesha

 

I'm not sure what the best way to do this would be/if it is possible. I took a look at a few different options to see what if anything can be done. In order to iterate a dynamic number of times, you would need to use the advanced branching. One thing you could try to do is find an API endpoint which returns a list of each business date between the start and end date custom fields. You could iterate over that response and tell if to create a new subtask for each business date returned. I haven't found an API like that, but one may exist that you could leverage.

 

You can get the total number of business days using this smart value - {{now.diff(issue.created).businessDays}}, but that doesn't give you anything to iterate over.

Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 11, 2022

There is an open feature request to iterate a number of times based on a custom field, but that hasn't been picked up yet. 

Like Nuwanee Nadeesha likes this

Hi @Kian Stack Mumo Systems

Thanks for the valuable feedback and details.

0 votes
Payden Pringle
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 08, 2023 • edited

Greetings Nuwanee,

I have recently released a Community Article specific to your issue, so I thought it'd be helpful to share it here.

How to create dynamic looping in Automation for Jira

I hope this helps.

Take Care,
Payden Pringle
Atlassian Support

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