Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation: Don't execute send if Lookup JQL has no results

Michael Glick January 20, 2022

I'm trying to create an automation that sends a Slack message listing the Jira items that meet a certain JQL query. I was able to set that up with the following objects:

  1. When: Schedule
  2. Then: Lookup issues (with JQL query)
  3. And: Send Slack message
    *The following items are open in JIRA*:

    {{#lookupIssues}}

    * <{{url}}|{{key}} - {{summary}}> [{{status.name}}] ({{assignee.displayName}})

    {{/}}

This works great, however it still sends that message even if there are no results from the Lookup's JQL query.

I tried wrapping it in an If-Then condition, but Jira then requires me to add the JQL to the Schedule component. By doing that it will then execute the Send Slack message component every time for each item in the JQL query results (which I obviously don't want to do).

What's the solution here?

1 answer

1 accepted

2 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2022

You should be able to do this by checking the size of the list and then configure your if condition similar to this

Screen Shot 2022-01-20 at 1.57.24 PM.png

Michael Glick January 20, 2022

That makes sense, but how would I check the size of the list?

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2022

The {{lookupIssues}} is a list, so all you have to do to get the size is to add .size to it like this {{lookupIssues.size}}. There are also other smart values that you can use with a list, check out https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists

Like 3 people like this
Kat Bruno October 18, 2022 edited

@Michael Glick Did you figure this out using list? If so, could you share?

I see that using Advanced Compare Condition with {{lookupIssues.size}} greater than 0 works.

 

Thanks for this thread!

Like 3 people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events