Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

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


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:


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.



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



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.



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):


1 answer

1 accepted

0 votes
Answer accepted

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

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

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

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?


I've just noticed the following article.

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.



In this post

@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

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