How to execute only if Lookup Issues returns one more more issues

Greg Hart September 25, 2020

I want to send a daily reminder listing a summary of tickets, but I only want the daily reminder to be sent if there are issues matching my JQL query. As I have it configured, an email is sent with no list if the query returns empty. 

 

Is there some way to set a condition so that my email only sends if the Lookup issue action returns one or more issues?

 

Screen Shot 2020-09-25 at 5.54.11 AM.png

2 answers

1 accepted

9 votes
Answer accepted
Isaac García February 11, 2021

I was searching how to do exactly this which led me to this topic. Somehow playing with the rules I managed to resolve it myself and I'd like to share it with you.

You must add an Advance compare condition just after a Lookup issues action with the next configuration:

lookupIssue.png

This will validate that lookupIssues must not be empty in order to trigger the following steps.

Reply if this worked for you so others can make use of it, have a nice day :)

Greg Hart March 8, 2021

Oddly enough, I just discovered that the lookupissues smart value existed the other day. This is a fantastic use of it, and I never would have considered it. Thanks!

Rostam Kilgour March 15, 2021

Hi I've made use of this and it's great. However I've been trying to generate a different notification when the list IS empty. So tried switching the rule around so that the Condition matches Empty. This however brings up an error when the list is empty, but strangely it doesn't generate an error when the list isn't empty. Does anyone know how I can fire off a rule for when {{lookupissues}} is empty?

Just trying to say something like "There are no logged issues todayjira_lookupissues.JPGjira_lookupissues3.JPGjira_lookupissues2.JPG

Like Hailin Test likes this
Greg Hart March 15, 2021

The comparison configuration you show above won't work, because it's going to look for the string "Empty". In the dropdown where you see "contains" there should also be an option for "is empty". That will allow you to check if the lookup found anything or not.

Rostam Kilgour March 16, 2021

Sadly there is no option for "is Empty" in the Advance Compare option. This is what I get.jira_lookupissues4.jpg

Greg Hart March 16, 2021

How strange. It only appears in the issue fields condition. Sorry about that. In this case, I'd try "does not match regular expression" and use the regex

^.*$

That regex searches for any character. So long as the field is empty, the condition "does not match" should work for you. 

Like Daniel Landino likes this
Rostam Kilgour March 22, 2021

Hi Greg - thanks for all your help with this. Still struggled to get what I needed to happen until I stumbled across the following Lookupissue feature.

{{lookupissues.size}} - this gives the result of how many issues are looked up. 5 issues looked up? then the size is 5. No issues looked up, the size is 0.

As such I simply used an advanced compare for my two rules. One if it returns issues (Grab below), and another for no issues (change the condition below to equals). I've made two separate rules but I presume an branched IF Advanced compare condition could contain everything in one rule. Hope this helps someone in the future.

FYI on the grab below you can use does not equal, or greater than - both do the same thing when trying to see if a there are any issues. The example below will not trigger any actions if lookupissues returns nothing.

jira_lookupissues5.JPG

Like # people like this
0 votes
Nic Brough -Adaptavist-
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 25, 2020

I wouldn't do this with automation, I would run that search, save it as a filter and then subscribe to it, setting the "do not email me on no issues returned" flag.

Greg Hart September 25, 2020

Sorry, my initial description of results was a bit unclear. I need a summary to be emailed to the approvers each morning, and it needs to be a bit more user friendly than a filter subscription email.

Will Freeman December 21, 2020

Also need this for automations that do not involve email; and this cannot be done with subscriptions.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events