Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create an issue for every component in a project via automation

Bent Möller
Contributor
March 12, 2024

Hey, Im new to Automation and Im still trying to figure out how to use branches correctly.

I have 5 Components in Project A, each Component has its own Lead.

Now I would like to create an issue every 3 months for every component from Project A in Project B and automatically assign it to the respective Component Lead.

So every 3 Months Project B will have 5 new Tickets, each assigned to the Component Leads of Project A's Components.

1 answer

0 votes
Bill Sheboy
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.
March 12, 2024

Hi @Bent Möller -- Welcome to the Atlassian Community!

Branches in automation rules can iterate over issues or arbitrary things with an advanced branch (e.g., some list of text values).  However they cannot iterate over the set of Components defined in a project as there is nothing built-in to get them.

So, some work-arounds are...

 

If your list of components is stable, you could hard-code them into a created variable, and then iterate over them.  For example, let's assume you have a variable named varComponentList with your components as a CSV list:

component A, blue, red, green

Then the advanced branch source could be: {{varComponentList.split(", ")}}

Better still, a lookup table could be used, storing the component as the key and the account id of the lead as the value: https://community.atlassian.com/t5/Automation-articles/New-Automation-action-Create-lookup-table/ba-p/2311333

 

But that is a brittle solution, as the rule will need updates as things change.  To make this more dynamic, the rule could call the REST API function to get the current list of components, and their assigned leads, using the Send Web Request action.  The {{webResponse.body}} could then be iterated over to create your issues using the advanced branch.

To learn more about this technique, here are some references:

Kind regards,
Bill

Bent Möller
Contributor
March 13, 2024

Hey Bill,

thank you very much for your answer and your suggestion. I kept trying yesterday and couldnt find a good way. I also thought about hard coding it, but the 5 Components was a simplification, in the end it will probably be at around 200. I thought about using the Components for Permissions to have the Component Lead as the responsible person for the permission, but I guess it just wont work that way.

I will probably look into realising it via Scriptrunner.

Bill Sheboy
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.
March 13, 2024

With that additional information, perhaps ScriptRunner will be better. 

Automation rules can process up to 150 issues / things in a branch (or 50 objects for assets), and so an advanced branch could not span 200 components: https://support.atlassian.com/cloud-automation/docs/automation-service-limits/

Like Matthias Schulz likes this
Bent Möller
Contributor
March 13, 2024

Thats a really helpful link, also for potential future tasks, thanks!

Like Bill Sheboy likes this
Bill Sheboy
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.
March 13, 2024

Here is another good one in that area: after the packaging changes for automation, they modified what counts toward monthly usage.

https://www.atlassian.com/blog/announcements/cloud-automation-packaging-update

Like Bent Möller likes this
Matthias Schulz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 24, 2025

Hi,

I'm a teammate of @Bent Möller . I understood the limitations of automation and created a Scriptrunner script.

Basically, this works wonderfully, but unfortunately it also reaches its limits very quickly due to the Atlassian restrictions, namely the 240-second limit.

Unfortunately, I ended up with more than 200 components. The script manages to create around 220 issues before the script is terminated.

Are there any other ideas on how this requirement could be implemented?

Many thanks for your help.

Bill Sheboy
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.
January 24, 2025

Hi @Matthias Schulz -- Welcome to the Atlassian Community!

Another possible approach would be to use the REST API to get all the components, and then create a CSV import file to create the issues.  That has a limit of up to 1500 issues and Atlassian will manage the throttling behind the scenes (over about an hour, according to their documentation).

Kind regards,
Bill

Like Matthias Schulz likes this
Matthias Schulz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 25, 2025

Hello @Bill Sheboy,

I understand your approach, but manual intervention is then necessary. I have now integrated a pagination for the script and create a corresponding number of scheduled jobs with the appropriate parameters for the start page and the maximum number of values.

I know this is not an optimal solution, but one that works once set up without having to intervene manually.

Best
Matthias

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events