Forums

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

How to perform an action for each issue in "Lookup issues" query?

anentropic
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!
April 28, 2025

The interface & docs for this feature are woefully under-developed.

It's not clear how to do simple things.

The "Lookup issues" action says you can:

Search for up to 100 issues using JQL and include the results list in other actions by using the {{lookupIssues}} smart value.

If I follow that with a For Each branch step the obvious thing is that I want to loop over the issues I just looked up and perform an action on each of them.

But so far I can't work out how to do this and neither the interface nor the docs give any help.

I tried an "Advanced branching" step with {{lookupIssues}} as the "Smart value".

But when I try to save my automation I get an error:

This component may be incompatible

One of the following needs to be produced earlier in the rule by the trigger or with a 'for each' branch for this component to work: 

  • Issue

In the "Advanced branching" step I had set the "Variable name" to "Issue"... so I don't know what is the problem here.

Screenshot 2025-04-28 at 13.57.06.pngScreenshot 2025-04-28 at 13.57.28.png

 

1 answer

1 accepted

5 votes
Answer accepted
Mikael Sandberg
Community Champion
April 28, 2025

Hi @anentropic,

Welcome to Atlassian Community!

The lookup issues can only be used as part of a list, you cannot use it in a For each loop. Instead you should use the JQL branch instead if you need to iterate over the returned result.

Screenshot 2025-04-28 at 6.15.07 AM.png

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.
April 28, 2025

Hi @anentropic -- Welcome to the Atlassian Community!

Adding to Mikael's answer...

The Lookup Issues action is the bulk-handling feature for work items selected by a JQL expression.  Its purpose is to sum / average / etc. values or to support bulk output, such as in a message or email.  The lookup results contain work item data, and so cannot be used with the work item actions, such as Edit Issue Fields, as they expect work item objects

To individually process a list of work items meeting some JQL criteria, either use the Scheduled trigger with JQL or a Branch on related items with JQL.  The one undocumented feature of the second type (Branch on JQL) is when the rule trigger provides an issue, that will be automatically excluded by the branch to prevent an endless loop / runway rule triggering.

Kind regards,
Bill

Like Darryl Lee likes this
anentropic
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!
April 28, 2025

Thanks, the validator let me save it with that change so it seems to have worked.

Has anyone at Jira put any thought into how users are supposed to discover the 'right way' vs these limitations?

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.
April 28, 2025

First thing, this is a community of product users, and not Atlassian Support, and I am just another customer participating in the community (i.e., not an employee of Atlassian).  If you have specific questions / concerns for Atlassian, paid license customers may contact them here or anyone may use the ? > Give feedback about Jira link in the products.

 

In my opinion...for many scenarios using automation rules, there are often multiple ways to solve a need, rather than a "right" or "wrong" way.  Instead, there are better or worse approaches, subject to the context.

Successfully using automation rules requires continual learning and experimentation.  As the product continues to evolve, there is no one-source-of-truth for all features.  Indeed, reading community posts and documentation, one will find new actions added every week!

My recommendation would be to create a test site / project and try things to experiment, and to regularly read the following to look for updates / issues:

 

Dirk Ronsmans
Community Champion
April 28, 2025

To add here even a little more.

While the JQL approach is the far superior one you should also be able to do it using the lookup Issues action.

Normally that would return a smart value {{lookupIssues}}, using that you could do a branch on a smartvalue, mainly "Advanced Branching"

https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/

 

So both solutions would work while you probably have less hassle using a JQL.

An advantage of using a lookup Issues action might be that you can do it outside of a branch and then validate against the smartvalue if you should even jump in to the branch and if not provide a proper action as well.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events