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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Loop over first X issues

We're setting up an automation which fires when a ticket is transitioned to closed. We then want to transition another ticket to In progress. The problem we're looking into is that there's no way (that we've found) to limit how many tickets you loop over. We're using this to get the issues: https://support.atlassian.com/jira-software-cloud/docs/work-with-related-issues/

- Use "For JQL" to lookup issues (in our case: status = "Pending" AND reporter = {{issue.reporter.accountId}} AND project={{issue.project.key}} order by created)

- We want to transition one of the resulting issues from this to In Progress.

The problem could be solved if one of the following was available:

- Condition/Variable that lets you look at which result number in the for loop you're on (I understand that they run in parallel, but you could still have a variable that tells you the position of the result)

- In the For JQL lookup, add a way to limit the results to a specific number. It limits it to 100, but there's no way to lower that limit.

1 answer

0 votes
Hana Kučerová Community Leader Nov 16, 2020

Hi @jctenney ,

welcome to the Atlassian Community!

I've been thinking about this and to be honest, I don't see any clean way of doing it.

Maybe if you share more information about your use case, we will be able to find any other way how to do it.

We basically only allow a single issue by reporter that can be in In Progress at a time. When one is closed, we need to grab the oldest issue (that is Pending) for the same reporter and move it to In Progress. 

Thank you.

The only possible way I can see is to create custom groovy script, but you would need some additional application for it, this situation is too much specific.

Yeah - we're actually on the cloud version, but custom variables don't solve the problem as for loops don't share the updates across them. In other words, if I change the value of a variable in one of the loop actions, the other loops don't see those updates. That's because it's not actually a for loop, but more like a fork of the process. Is there a place I can create a feature request for Jira Automation in the Cloud? I'm not seeing an obvious project for that type of request.

I've already resorted to using Scriptrunner to do what we need. We were so close on Jira Automation though and would have been nicer to have it there than in code.

Hana Kučerová Community Leader Nov 17, 2020

Yes, sorry, I realized it too late that you are on cloud (probably the codebarrel tag confused me).

I think the best place is Jira Cloud (including JIRA Core) + component Automation for Jira.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

342 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you