Jira Automation email for 3 categories of Labels

Sridhar Gandla October 23, 2023

I would like to write one automation rule of 3 categories of Labels.. My JQL will fetch all 3 categories of Labels in Single JQL Query.. So, for all good.  In Jira Automation rule, can I use If condition Label = Category 1 in On single Tabular format and 2nd Table Label = Category 2. Finally. Label = Category 3 in 3rd Table... I mean, Key, Summary, Lable 1 is my table Header row. 

Please suggest, how do I do this ?

1 answer

1 accepted

0 votes
Answer accepted
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 24, 2023

Hi @Sridhar Gandla

you can use one JQL to fetch the issues of your three different categories and achieve something like you've requested.
After issuing the JQL, e.g. with a Lookup Issues action, you can use a send email action with a template like this:

Table 1:
<table>
{{#lookupIssues}}
{{#if(equals(labels.first, "cat1"))}}
<tr><td>{{key}}</td><td>{{summary}}</td></tr>
{{/}}
{{/}}
</table>

Table 2:
<table>
{{#lookupIssues}}
{{#if(equals(labels.first, "cat2"))}}
<tr><td>{{key}}</td><td>{{summary}}</td></tr>
{{/}}
{{/}}
</table>

Please note that this template only checks the first label in case an issue has multiple ones, I was not sure how to iterate through multiple labels.

Therefore, I'd suggest that you simply create 3 lookupIssues actions and filter them by label in the JQL already. Then you can simply print the result of all these without additional filtering while constructing the email.

Cheers,
Matthias.

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 24, 2023

Hi @Sridhar Gandla 

Would you please confirm you are using Jira Server, and not Jira Data Center (or Jira Cloud)?

If you are using Jira Server, you will not have the Lookup Issues action which Matthias describes.

Instead you could either user the bulk-handling feature of Jira Server automation, with the {{issues}} smart value substituted where Matthias noted using {{lookupIssues}} ...

Or, use JQL and the Send Web Request action to call the REST API issue search function, using the web response in the same way as the other bulk options.

And one question: can the different labels be assigned to the same issue?  If so, what would you expect to happen in the table output?

Kind regards,
Bill

Like # people like this
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 24, 2023

Oh, @Bill Sheboy - you're so right. I missed the server tags on this post. 🙈

Thank you for providing some alternatives for the server world.

Like # people like this
Sridhar Gandla October 25, 2023

I am using Data Center version...

Sridhar Gandla October 25, 2023

Greetings Matthias Sir 

I really appreciate the great help in this regards.   Labels Logic is great !!  I fixed it now.  It worked the way I wanted. 

Most of the time, I was making Syntax and HTML tags incorrectly are killed my time.

The  "last" label also works the same way as first label. 

Really appreciated your support !!

Like # people like this
Sridhar Gandla October 25, 2023

Greetings Bill Sir 

Really appreciated your support !!

Like # people like this

Suggest an answer

Log in or Sign up to answer