Forums

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

Iterate on subset of lookupissues by if-equals smart value

Agnes Bodor
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!
September 8, 2025

I have a scheduled automation which

1. Defines lookupIssues with a JQL

2. Has a "for each smart value" branch for the components by MyComponent = {{lookupIssues.components.name.distinct}}

3. I would like to send out for each distinct component an e-mail that contains the keys and fix versions; however, the email body doesn't contain anything, where I have the following code

email body:

{{#lookupIssues}}

{{#if(equals(issue.components, {{Mycomponent}} )) }}

* {{key}} : {{fixVersions.name}}

{{/}}

{{/}}

 

Rem.:

I did print out the {{MyComponent}} and it is valid, there are distinct values

There are items, and fix versions, I printed them out too.

 

Any ideas where I am making the mistake?

 

Thanks!

1 answer

1 accepted

2 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.
September 8, 2025

Hi @Agnes Bodor -- Welcome to the Atlassian Community!

You are encountering a limitation of the long-format of list iterators: Once inside the iterator, no outside data is visible.  Only data from the iterator, and lower can be accessed.

Thus, your MyComponent variable cannot be used to filter the list.

 

The workaround for this is to use the Lookup Work Items action twice, as shown in this related knowledgebase article.  I also added the flatten function to correct a problem in your advanced branch's smart value.

  • trigger: scheduled with no JQL
  • action: lookup work items, to find your components with your original JQL
  • advanced branch: over your distinct component values...
    • variable name: varComponent 
    • smart value:  {{lookupIssues.components.name.flatten.distinct}}
      • action: lookup work items, with the JQL added to...
        • your original JQL AND component IN ( "{{varComponent}}" )
      • action: send the email, iterating over the {{lookupIssues}} for just this single component

The flatten is needed because the Components field is a list, and thus with the lookup it produces a list-of-lists...where the distinct function will work on sets of components, rather than on individual ones.

 

Kind regards,
Bill

Agnes Bodor
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!
September 9, 2025

Thank you Bill! 

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events