Forums

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

In Automation How can I get a single email based on an if {{lookupIssues.size}} equals 0?

Cash Coyne
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.
July 10, 2023

In automation, I have a rule that runs daily, using this query:

Filter="Issues in Open Sprint" and status not in (Done,"Ready for Release",Cancelled,Declined) and resolution is empty

It does a lookup based on this JQL:

Filter="Issues in Open Sprint" and status not in (Done,"Ready for Release",Cancelled,Declined) and resolution is empty and assignee = "john.smith@company.com" 

Then I do an if matches on {{lookupIssues.size}} equals 0

If that matches, I want it to send out ONE email.  It looks to be sending out an email for every issue returned from the JQL!

How can I get it to send only ONE email?

For some more color, the objective here is to get an email if there are NO issues that match the query (I'm trying to find out if I have a developer that has no issues on their plate).  

This is the rule:
Jira Automation Test Looping Assignee.JPG

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
July 10, 2023

Hello @Cash Coyne 

With a Schedule trigger the actions within the rule will be run once for each issue returned in the JQL associated with the trigger.

What is the CurDev variable being set to? What is its purpose?

Why do you have a JQL in the trigger and then use a Lookup Issues action to run the same JQL with an additional criteria for Assignee? Why don't you have the Assignee criteria in the JQL in the trigger?

Cash Coyne
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.
July 12, 2023

CurDev isn't really needed. I need to remove that.  I have the JQL in the trigger without the assignee to limit the number of issues at that point.  Then with the assignee for the lookup as I plan to repeat this sequence for a few different assignees.  The end objective is to total the number of issues that match lookup and then send out an email with that total number for each assignee (thus each lookup).

My problem is how to get just one email sent

Trudy Claspill
Community Champion
July 12, 2023

Here is one solution:

Take the JQL out of the Schedule trigger. Then the steps in the rule will run only once each time the schedule triggers the rule

Add multiple Lookup Issues actions to run the filter for each assignee.

After each Lookup Issue action add a Create Variable action to record the number of issues returned.

Finally, as the last step, use a Send Email action to send the information. You can include each variable you created in email content.

 

I think there might be another way to run the Lookup Issue action just once without including an Assignee criteria and then using something like the distinct function to get the count of issues for each distinct assignee in the result set. But I don't have an example of that and haven't worked out the details. I think this post might be discussing something similar.

https://community.atlassian.com/t5/Jira-Software-questions/Automated-Email-to-Managers-Containing-JQL-Results/qaq-p/2246402

Cash Coyne
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.
July 13, 2023

That worked. Thanks!

Cash Coyne
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.
July 13, 2023

BTW, I checked the link you provided and it has possibilities, but the problem is that it only works when issues are found for an assignee.  If an assignee has no issues then I can't identify that someone has no issues, so a Catch-22 type thing.  But the steps you recommended before the link did the trick.

Like Trudy Claspill likes this

Suggest an answer

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

Atlassian Community Events