{{lookupIssues.size}} not working for me when I want to send an email if a criteria is true

Alex Czerwinski September 7, 2022

Hi all, I hope you can help with a problem I've been grappling with for a couple of days now.

I am trying to run a JQL query on a Jira project to see if it has any issues that match a criteria - which seems to work OK.  Here is an example where 2 issues are found:

2022-09-07_10h29_37.png

Then I use an If block (Advanced Compart Condition) to see if the value is greater than or does not contain 0.  I am using either 0 or <Empty> as the value in this compare condition.  But whatever options I try I cant get it to send an email if there is an Issue that meets the criteria and not if it doesn't.

See below example of a project with 2 issues that meet the criteria and I use {{lookupIssues.size|0}} greater than <EMPTY> which actually gives the correct response.

2022-09-07_10h39_99.png

 

But when I use it on a project with no issues it still sends out an email.

2022-09-07_10h47_19.png

 

Another example is when I use {{lookupIssues.size|0}} does not contain 0 for a project with 2 issues that meet the criteria ... but this does not send an email out.

2022-09-07_10h52_11.png

 

Can anybody help and advise at all the best approach to automate sending an email if there are Issues that match a criteria within a Jira Project?

I've also done some analysis of the output of several variants of criteria (see below):

2022-09-07_10h42_56.png

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2022

Hello @Alex Czerwinski 

You have made your comparison too complicated.

If the JQL finds no matching issues, then the "size" of lookupIsssues will be 0. You don't need to try to compare it to EMPTY.

If you want to send the email only when issues are found then use the Advanced Compare to ensure the size of lookupIssues is greater than 0.

Screen Shot 2022-09-07 at 9.21.44 AM.png

Alex Czerwinski September 8, 2022

Thanks for getting back to me @Trudy Claspill  , your help is much appreciated.

I had previously tried the greater than condition with 0 as the second value but was unable to get it to work correctly.  As you can see from the image below I've tried it on a Jira Project with No issues that match the criteria (bottom right) which seems to work correctly and does not send out an email, and one with 2 issues that meet the criteria (top right). But this also does not send out an email. Also it seems to suggest that the 2 issues it finds which meet the criteria did not match the condition ... i.e. {{lookupissues.size}} is greater than 0.

Is there anything else that could be wrong with the condition?Picture5.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 8, 2022

Ok, I believe I see the problem now. I didn't look at your rule closely enough.

To use the lookupIssues smart value you must first use the Lookup Issues Action. The lookupIssues smart value does not apply to the results of a JQL you run in a Schedule Trigger.

Screen Shot 2022-09-08 at 7.41.42 AM.png

Like Rafa likes this
Alex Czerwinski September 9, 2022

Thanks @tru that sounds as if it will fix the issue.

I've looked to create a new action ... but in searching all actions that are available it does not appear to contain the 'Lookup issues' action unfortunately.

Is this a bolt on that my organisation possibly does not have, or perhaps available from somewhere else?

2022-09-09_08h51_13.png

Alex Czerwinski September 9, 2022

I've just noticed the following article.

https://community.atlassian.com/t5/Automation-questions/automation-and-lookup-issue/qaq-p/1415923

I thought I was on Jira Cloud, but I've found out today that we are on a Data Centre version of Jira which may be why I can't see the "lookup Issues" action.

 

 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2022

In this post

https://community.atlassian.com/t5/Jira-questions/Check-issue-count-while-using-Jira-automation-Jira-Server/qaq-p/1781574

@Bill Sheboy suggests that you can use the smart value {{issues.size}} to get the count of issues for a JQL executed as part of a Schedule trigger, on Jira Server/Data Center. Try that instead of {{lookupIssues.size}} in your Advanced Compare.

Like Alex Czerwinski likes this
Alex Czerwinski September 12, 2022

Thank you, that's done the trick nicely.  thanks for your help sorting this out ... I was about to give up :)

Suggest an answer

Log in or Sign up to answer