Forums

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

Create tickets in all projects that meet certain criteria?

Shawn Oster
Contributor
January 24, 2024

I need to create the same ticket in multiple projects and I'd prefer not to create a discrete Create Issue action for each project.

Ideally I could query on project details, something like:

for each project where project.category == "Feature Team":
create issue

If that doesn't work using JQL or a filter:

for each project in (ABC, DEF, EBC):
create issue

 Pretty much anything except:

create issue in ABC
create issue in DEF
create issue in EBC

Any ideas?

Cheers,

Shawn 

1 answer

1 accepted

0 votes
Answer accepted
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 28, 2024

Hi @Shawn Oster 

What version of Jira are you using?  If it is Jira Cloud...

You could try creating a variable with the list of projects' id values, separated by commas, and then use an advanced branch to loop over those.  In the issue create action, use the branch variable as the project key.

  • action: create variable
    • variable name: varProjectList
    • smart value: 10010,10011,10012
  • advanced branch
    • variable: varProject
    • smart value: {{varProjectList.split(",")}}
      • action: create issue, using {{varProject}} 

I have not tried this, so I do not know if the issue will successfully create with a lop variable as the project key.

Kind regards,
Bill

 

UPDATE: I changed the CSV list of project names to use the projects' id values and the rule worked as expected.

 

Shawn Oster
Contributor
February 7, 2024

Hey Bill, that was a great suggestion but unfortunately you can't use smart values as inputs to the project list, as you suspected.

Give the number of projects (30+) I think I'm going with a quarterly CSV import.

Thanks again 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.
February 7, 2024

Sorry, I should have tested first: this only works if the list in the variable is the project id values.  I will update my earlier post :^)

Shawn Oster
Contributor
February 7, 2024

Bill, you are my hero!

For future generations, you *can* use either project ID or key, depending on how you set your "More Options".

{
"fields": { "project": { "key": "{{projectKey}}" } }
}

 I was getting stuck trying to set the project in the UI somehow, which obviously doesn't support smart values.

I dearly wish I could write actual code, and I was sorely tempted to write a lambda instead that used the REST API, but this approach allows me to hand off maintenance to our product folk instead.

Thanks again for your help, saved me a ton of time!

Cheers,

Shawn

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.
February 8, 2024

Well done! 

I was using the dropdown field to set the project and did not try using the JSON edit for fields already shown in the Create Issue action, such as project and type.  I suspect this technique would also support creating with the one-off issue types and status values in team-managed projects.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events