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

How can I use Advanced Branching in Automation for unique results?

I created an automation a while back that sends emails daily to the assignee of any issue that is overdue. This resulted in numerous individual emails for some users and I was asked to instead send out bulk emails.

Here is my basic workflow:

  • When the rule is triggered, run a JQL query to find all issues that are in an active status.
  • I then pass the results through an IF statement checking for issues that have assignees and are currently overdue.
  • Within the IF, I added an Advanced Branch that does an action for each assignee from the issues that passed. (This is where I need help.)
  • I use the variable {{currentAssignee}} from the Advanced Branch to run a JQL lookup that returns only the issues assigned to that user.
  • Finally, I trigger an email with those results in bulk.

It almost works. The problem I run into is Automation doesn't filter the assignees for unique users. So if a user has five overdue issues, they will receive five identical emails with all of the issues listed.

I've searched and come up empty-handed trying to find a way to filter the list of assignees for unique ids. Any help is appreciated.

Screenshot below:

2022-01-12_11h53_08.png

2 answers

1 accepted

1 vote
Answer accepted

Hi @Brock Jolet 

There appears to be a newer (?) feature for lists which allows pulling distinct values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#list.distinct

Given what is described and your use case, I expect you could use a Lookup Issues action to find issues meeting the criteria: has an assignee and is overdue.  Then use this to populate a created variable: {{lookupIssues.assignee.distinct}}

And then split that created variable back into a list to drive the advanced branching, with one loop for each assign.  The reason I suggest the created variable is so you can use lookup issues within the branch to create one email per assignee.

Kind regards,
Bill

Thanks, @Bill Sheboy .

This put me on the right path to accomplish my goal.

I originally was going to do more actions in the same rule, but opted for multiple rules. So I was able to remove the IF statement and removed my JQL search from the Cron.

I didn't need to store a custom variable, but I did use {{lookupIssues.assignee.distinct}} to feed the Advanced Branching. That was key.

I wonder if this is what @John Funk was hinting at in his post.

Here's a screenshot of the final rule:

2022-01-13_10h37_41.png

Like # people like this
John Funk Community Leader Jan 13, 2022

Yes, it was - sorry, just now able to get back to this. 

Like # people like this
0 votes
John Funk Community Leader Jan 12, 2022

Hi Brock,

Take a look at this previous post. I would use the lookupIssues smart value function to do that. 

https://community.atlassian.com/t5/Jira-Software-questions/Sending-an-email-with-a-list-of-issues-using-Automation-for-Jira/qaq-p/1192501

Hello @John Funk , 

I read through that thread and don't think it addresses my issue. I'm already producing emails with a list of issues via the Lookup Issues component. The problem is that I'm getting multiple emails with the same information instead of just one.

I'm returning a list of issues from my IF statement, pulling out the list of assignees for those, and then using the Lookup Issues component to run a new query for populating the emails.

I'd like to figure out how to take the list of assignees and strip it down to only unique IDs before passing them into the Lookup Issues component.

Please correct me if I misunderstand how you would use the Lookup Issues component.

Suggest an answer

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

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

125 views 1 2
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