Loop over first X issues

jctenney November 14, 2020

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 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.

jctenney November 16, 2020

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. 

Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 17, 2020

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.

jctenney November 17, 2020

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 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
AUG Leaders

Atlassian Community Events