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

How would one create multiple tables with unique JQL search when sending an email through automation

Zach May 2, 2024

I am trying to create an automation that will send an email out that contains multiple tables in it. 

For example I want to gather the total number of tickets created in the specified project within the last 24 hours and from that data I would like to be able to create multiple tables based on specific values/fields contained with in those tickets

 

I already have an automation set up to perform a look up and report out all tickets in an email but the granularity of the tables is what I am struggling with


I am working with Jira Server

Example of what I would like the results to look like:

MultiTables.PNG

1 answer

1 accepted

0 votes
Answer accepted
Kalyan Sattaluri
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.
May 2, 2024

Hello @Zach 

Welcome to the community..

You need to use list iteration and conditional statements to make it work..

I havent tested below syntax, but this is how I usually solve it.. Notice the bolded part, thats how you you can filter each block of your table.

 

<table border='1' style='border-collapse:collapse'> 
  <tr>
<th>Issue Type</th>
<th>Key</th>
<th> Status </th>
<th>Summary</th>
  </tr>
<tr>
{{#issues}}{{#if(equals(status.name, "Done"))}}
<td> {{issueType.name}}</td>
<td><a href="{{toUrl}}">{{key}} </a></td>
<td>{{status.name}} </td>
<td> {{Summary}} </td>
</tr>
{{/}}
{{/}} 
</table>
Hope it helps.
Kalyan Sattaluri
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.
May 2, 2024

Below will be the criteria in your case for example:

{{#issues}}{{#if(equals(issueType.name, "Type A"))}}    

 

Zach May 2, 2024

Here is what i have an its populating an error "Error rendering smart-values when executing this rule:"

<h3><h3>Daily New Issue Report</h3>

<p><b>Total Tickets</b>: {{lookupIssues.size}}</p>

<p><b>Type A Tickets </b></p>
<style>
table {border-collapse:collapse;}
table, td, th {border:1px solid black;}
table, td, th {font-family: calibri;}
th {background-color: rgb(217,217,217);color:black}
table, td {font-size:90%;height: 25px}
th {font-size:95%;}
td {text-align:center}
</style>

<table border="1">
<tr>
<th style="width:100px">Key</th>
<th style="width:150px">Issue Type</th>
<th style="width:150px">Reporter</th>
<th style="width:1000px">Summary</th>
</tr>{{#lookupIssues}}{{#if(equals(issueType.name, "Type A"))}}
<tr>
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{reporter.displayName}}</td>
<td>{{summary}}</td>
</tr>
{{/}}</table>

<p><b>Type B Tickets </b></p>
<table border="1">
<tr>
<th style="width:100px">Key</th>
<th style="width:150px">Issue Type</th>
<th style="width:150px">Reporter</th>
<th style="width:1000px">Summary</th>
</tr>{{#lookupIssues}}{{#if(equals(issueType.name, "Type B"))}}
<tr>
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{reporter.displayName}}</td>
<td>{{summary}}</td>
</tr>
{{/}}</table>

Kalyan Sattaluri
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.
May 2, 2024

Hello @Zach 

Couple of things:

lookupIssues in Server/Data Center does not expose all fields. In my test, issuetype.name is one of them. So you need to confirm that all the fields you want are available by logging them before using them in your email. If you are not able to log {{lookupIssues.issueType.name}} you are limited to using JQL in the scheduled trigger and reference {{issues}} from that results instead of lookup.

Second is that, you are missing closing tags in each block.. (highlighted)

<table border="1">
<tr>
<th style="width:100px">Key</th>
<th style="width:150px">Issue Type</th>
<th style="width:150px">Reporter</th>
<th style="width:1000px">Summary</th>
</tr>
<tr> {{#issues}}{{#if(equals(issueType.name, "Story"))}}
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{reporter.displayName}}</td>
<td>{{summary}}</td>
</tr>
{{/}}{{/}}</table>

Zach May 2, 2024

Ok, yeah i scrapped the lookup action, switched to a scheduled jql and added the closing tag. It started to produce the results I'm looking for. I was able to create 2 tables that are unique based on issue type. I just need to finish cleaning it up so it displays how i want. Thank you for your help!

Like Kalyan Sattaluri likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events