Forums

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

Automation for each issue

Kevin McGillicuddy
Contributor
September 27, 2021

I have a an automation that runs every night at 11:30PM EST which queries a project and finds issue(s) wthat meet the critera. What I want it to do is create a single version then foreach issue found edit the version field to match the created version and then release the version

rule.PNG

What is happening is it seems to have run twice?

Here is the query that is scoped to that project
updatedDate < endOfDay() AND updatedDate > startOfDay() AND Sprint is EMPTY and fixVersion is EMPTY and deploymentEnvironmentName ~ “prod“ and status = resolved

run_twice.PNG

Any help would be appreciated 



1 answer

1 accepted

0 votes
Answer accepted
John Funk
Community Champion
September 27, 2021

Hi Kevin,

It looks like it is trying to create a version for every issue returned in your query. 

I would remove the query from the Scheduled trigger part but leave the create version where it is. 

Then change your Branch for JQL and put the query there. 

Kevin McGillicuddy
Contributor
September 27, 2021

that makes so much sense! 

For documentation sake I removed the JQL from here and moved to a new branch 

change2.PNG

 

new layout:

change1.PNG

Kevin McGillicuddy
Contributor
September 27, 2021

Thinking more about this - I will need a null check so it does not create a version if nothing was - any thoughts on best way to do this? So I don't want empty versions to be created and released 

John Funk
Community Champion
September 27, 2021

Let me think about that a little more. Maybe using lookupIssues with a count and the count > 0  but I would have to work out the code. That might take a day or two or maybe @Bill Sheboy could help in the short term. 

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.
September 27, 2021

Hi @Kevin McGillicuddy and @John Funk 

Yes, I agree with John.  Please try this:

  • after the trigger, add an action for Lookup Issues with the same JQL you plan to use in the branch
  • next, add an advanced compare condition to halt processing if no issues are found
    • first value: {{lookupIssues.size|0}}
    • condition: greater than 
    • second value: 0

 

Kind regards,
Bill

Like John Funk likes this
John Funk
Community Champion
September 27, 2021

Thanks, Bill!!

Kevin McGillicuddy
Contributor
September 27, 2021

Thanks Bill appreciate that will give this a try!

Also do you think then I would be able to change my branch rule (in the second picture above) from JQL, as John suggested, to now be All Created issues? I may play with that in sandbox - basically trying to avoid having the JQL listed twice but its not the end of the world

Like John Funk likes this
John Funk
Community Champion
September 27, 2021

You aren't actually creating issues in this rule, so I don't think the All Created issues would apply. Plus you are running it at 11:30 pm so it shouldn't hurt to hit JQL twice. 

Like 2 people like this
Kevin McGillicuddy
Contributor
September 27, 2021

Thanks will let you know what happens 

Like 2 people like this
Kevin McGillicuddy
Contributor
September 29, 2021

this worked perfectly 

Like 2 people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events