Forums

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

How can I get distinct components across a set of issues?

seamus
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!
October 30, 2024

I'm trying to add an automation that will:

  1. Look up a certain set of issues.
  2. Group that set by component and send one notification for each component.

 

That automation currently looks like this:

  1. Lookup Issues: using "<my query>".
  2. If: `{{lookupIssues.size}} > 0`.
  3. Advanced branch: For each value in `{{lookupIssues.components.name.distinct}}` (variable named `distinctComponent`):
    1. Lookup Issues: using "<my query> AND component == {{distinctComponent}}".
    2. Send Slack notification: for that component.

This breaks if an issue is returned by my query that has more than one component value (component is required for this project so it's guaranteed we will have at least one value).

How do I get the distinct set of individual component values across the entire set of issues, instead of the distinct combinations of component values across the entire set of issues?

1 answer

1 accepted

4 votes
Answer accepted
Tuncay Senturk _Snapbytes_
Community Champion
October 30, 2024

Did you try

{{lookupIssues.components.name.flatten.unique}}

while flatten breaks down arrays, unique will remove duplicates.

Also did you try removing the  == and use only one =

"<my query> AND component = {{distinctComponent}}"

I hope it helps

Tuncay Senturk _Snapbytes_
Community Champion
October 31, 2024

btw, I've managed to run a similar scenario

Like Tasos Stefanidis likes this
seamus
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!
October 31, 2024

Confirming that `flatten` works, thanks! Although this is not documented under Smart value list documentation - so I'm not sure how I could have found out it existed without asking here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/

Working syntax is `{{lookupIssues.components.name.flatten.distinct}}`

The `==` in my question was just a syntactical error that was not present in my query!

Like Tasos Stefanidis likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events