Automation rule - send by mail a recap table with lookup issues

Garn February 14, 2024

Hi,

I'm using Jira Software (v9.4.8) Data center in my company. I'm administrator of my project, but not administrator of the full instance. 

I'm trying to use an automation rule to, by click, send a mail with a table containing all the issues with priority = highest. I have 7 columns in my table ; 1 column displays 1 attribute.

I'm succeeding to display 4 of my 7 columns. The 3 last columns are empty, even if the information is well described in my ticket. When I try to call the attribute value of my current ticket outside of my lookup issue loop, it's working. When I call it inside my lookup issue loop, it's not working.

Status of my audit log is "success".

 

lookup1.png

 

Here is the code of my "Send mail" action:

<table style="border-collapse: collapse" table-layout="fixed" width="100%">
<tr>
<th style="border: 1px solid #000000; background-color : #CDCACA" valign="middle" halign="center">Clé</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Résumé</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Statut</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Responsable</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">PIC</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Priority</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Last comment</th>
</tr>

{{#lookupIssues}}
<tr><td style="border: 1px solid #000000" valign="middle" align="center"><a href="{{toUrl}}">{{key}}</a></td>
<td style="border: 1px solid #000000" valign="middle">{{summary}}</td>
<td style="border: 1px solid #000000" valign="middle">{{status.name}}</td>
<td style="border: 1px solid #000000" valign="middle" align="center">{{assignee.displayName}}</td>
<td style="border: 1px solid #000000" valign="middle" align="center">{{customfield_11600}}</td>
<td style="border: 1px solid #000000" valign="middle" align="center">{{customfield_11601}}</td>
<td style="border: 1px solid #000000" valign="middle" align="center">{{comments.getFromEnd(0).body}}</td>
</tr>
{{/}}
</table>

 

Here is the result by mail:

lookup2.png

 

 

Could it be a problem from administration right?

How could I display my values?

 

Thank you,

1 answer

1 accepted

0 votes
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.
February 14, 2024

Hi @Garn -- Welcome to the Atlassian Community!

For Jira Server / Data Center, the lookup issues action only supports some fields at this time.  Here is the suggestion to add more, which you may vote for / watch to see progress: https://jira.atlassian.com/browse/JIRAAUTOSERVER-877

When the lookup issues action was added for Jira Cloud, it also supported a limited number of fields.  About a year later, all of the remaining ones were added.  Perhaps that will also happen for the other versions.

 

Until then...a couple of work-arounds are:

  1. Use a branch on JQL with the bulk-handling option, as that will provide the {{issues}} smart value, and allow handling issues the same as a lookup.  Please look here to learn more about that feature: https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html
  2. Use a Send Web Request action to call the REST API function to search by JQL.  Then the {{webResponse}} could be used to iterate over the issues.

 

Kind regards,
Bill

Garn February 15, 2024

Hi Bill,

Thank you a lot for your help.

I tried your first work-around, and now it's displaying all the information as required in the table. The problem now is that I have a table with 1 row, and all information of my tickets are stored in the same column cell, separated with comma.

mail synthesis.PNG

Any idea how to display it with one ticket = one row ?

 

 

Here is my new automation rule

mail synthesis2.PNG

 

<table style="border-collapse: collapse" table-layout="fixed" width="100%">
<tr>
<th style="border: 1px solid #000000; background-color : #CDCACA" valign="middle" halign="center">Clé</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Résumé</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Statut</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Responsable</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">PIC</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Priority</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Last comment</th>
</tr>

<tr><td style="border: 1px solid #000000" valign="top" align="center"><a href="{{toUrl}}">{{issues.key}}</a></td>
<td style="border: 1px solid #000000" valign="top">{{issues.summary}}</td>
<td style="border: 1px solid #000000" valign="top">{{issues.status.name}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{issues.assignee.displayName}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{issues.customfield_11600}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{issues.customfield_11601}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{issues.comments.last}}</td>
</tr>
</table>

 

 

Thank you!

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.
February 15, 2024

In your original rule, you iterated over the lookup with this:

{{#lookupIssues}}

using the data for the table, such as {{key}} and {{summary}}

{{/}}

 

Now using bulk-handling for issues, it would be this:

{{#issues}}

using the data for the table, such as {{key}} and {{summary}}

{{/}}

 

Garn February 16, 2024

Hi Bill,

Thank you for your time! Unfortunately, I still need some help. With {{#issues}} instead of my {{#lookupIssues}}, it's still not displaying the data into a table. The first ticket is into the table, then everything is outside.

mail synthesis3.PNG

 

Here is my code

 <table style="border-collapse: collapse" table-layout="fixed" width="100%">
<tr>
<th style="border: 1px solid #000000; background-color : #CDCACA" valign="middle" halign="center">Clé</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Résumé</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Statut</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Responsable</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">PIC</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Priorité</th>
<th style="border: 1px solid #000000; background-color: #CDCACA" valign="middle" halign="center">Dernier commentaire</th>
</tr>
{{#issues}}
<tr><td style="border: 1px solid #000000" valign="top" align="center"><a href="{{toUrl}}">{{key}}</a></td>
<td style="border: 1px solid #000000" valign="top">{{summary}}</td>
<td style="border: 1px solid #000000" valign="top">{{status.name}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{assignee.displayName}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{customfield_11600}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{customfield_11601}}</td>
<td style="border: 1px solid #000000" valign="top" align="center">{{comments.last}}</td>
</tr>
</table>
{{/}}

 

Plus, I also figure out that if I call the rule in a highest priority ticket, it's displaying all the highest priority ticket except the one from which I called the automation rule. Not my priority, but to keep in mind.

 

Do you have a solution for the display of data in my table with 1 ticket = 1 row ?

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.
February 16, 2024

Notice that the closing {{/}} is outside the scope of the table row </tr> and thus impacts the table.  Try moving {{/}} to immediately after </tr> and re-test.

 

Regarding the missing issues, I wonder if there is a built-in constraint on the JQL branch to exclude the trigger issue (by automatically adding to the JQL).  I know that is the case for some branches, but I am not using Jira Server / Data Center version and so cannot test that.  Perhaps try making your JQL more explicit and see what happens:

( priority = Highest OR key = {{triggerIssue.key}} )

Garn February 18, 2024

Hi Bill,

 

It's working perfectly well now.

Thank you for your help!

 

Regards

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer