Automations referencing Filters

Dan Rohtbart March 24, 2022

We have an advanced Filter, "Recent Customer Issues" which uses JQL. And we're successfully using that Filter in a Dashboard. Now, I need to create an email which includes the results of that same Filter, in addition to some other text. I'm trying to avoid copy-and-pasting the JQL from the filter, so the Dashboard and Email will remain consistent.  

My first attempted solution is using Global Automation, and the Lookup Issues action. Is there a way that I can reference that Filter in the Lookup Issues? Trying {{Recent Customer Issues}} in the JQL field applies no filter. 

  1. Is there a way for me to reference the Filter from Automations, without copy-and-pasting the JQL?
  2. Alternatively, is there a way for me to email the Dashboard, or reference it in an Automation?

Thanks,
Dan

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
March 24, 2022

Hi @Dan Rohtbart -- Welcome to the Atlassian Community!

If you have used a saved filter for your dashboard gadget, you can use that same filter in the automation lookup issues action by referencing the filter id.

View your saved filter to note the id in the browser address bar URL, and then use that in the lookup JQL as:

filter = 12345

Please note: automation rules actions, branches, and triggers are limited to processing 100 issues.  If your filter returns more the result will only contain the first 100 issues.

Kind regards,
Bill

Dan Rohtbart March 25, 2022

@Bill Sheboy this looks absolutely perfect. Thank you so much. 

Like Bill Sheboy likes this
Dan Rohtbart March 25, 2022

Even better, you can combine filters: 

(filter = 10041) or (filter = 10042)
Claudio Rouillon October 4, 2022

Hi Bill, is it possible to use the size (as in issue count) of a given filter?

Thanks,

Bill Sheboy
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.
October 5, 2022

Hi @Claudio Rouillon 

You cannot get the count by running a query directly with the Jira UI, but you can do so with other methods:

  1. for Jira Cloud automation, using Lookup Issues with the JQL, and then check {{lookupIssues.size|0}} for the count (adding a default of zero to avoid nulls)
  2. for Jira Server/Data Center automation with bulk processing, use {{issues.size|0}}
  3. for a REST API call, check the count shown in the response message
  4. for a custom written application calling the REST API, same as #3 except whatever collection/list sizing your language uses

Kind regards,
Bill

Like Claudio Rouillon likes this
Claudio Rouillon October 5, 2022

Thanks Bill,.  I have tried the first option within an automation rule and found 2 problems... (1) I get one email per issue returned from the list... I would prefer all issues listed in 1 email, couldn't figure out how to. (2) the size is returning 0. See below.

Jira autom weekly emailrule email example.JPG

Jira autom weekly emailrule 2.JPGJira autom weekly emailrule 1.JPG

Claudio Rouillon October 5, 2022

Hi Bill, after a few trials I figured it out... here is my rule with the count (size) of the issue list in the Subject line. Thanks for your help !

Jira weekly list rule.JPG

Bill Sheboy
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.
October 6, 2022

Hi @Claudio Rouillon 

Just to confirm, are you using Jira Cloud or the Server/Data Center version?

It appears you are using Cloud, so...

With this type of rule you do not use JQL with the scheduled trigger.  Instead you only use the Lookup Issues action, and then there will be one email, referencing the {{lookupIssues}} smart values.

I noted you referenced the {{issues}} smart value, noting the plural word.  That smart value is used with Jira Server/Data Center for bulk-issue processing, whereas Cloud uses Lookup Issues.

Like Claudio Rouillon likes this
Claudio Rouillon October 6, 2022

Hi Bill, yes we use Jira Cloud. And yes, we used {{#LookupIssues}}. Thanks for helping out.

Like Bill Sheboy likes this
1 vote
Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2022

Hi Dan, have you looked into Group Subscriptions.
See: Subscribe to search results on this page
Work with Search Results 

Hope this helps.

Suggest an answer

Log in or Sign up to answer