How to create an email with sorted list based on issue types?

Gil Levy May 22, 2024

Using automation in jira, I would like to generate an email with a list of issues in a released version.

I want to have a list of bugs and a list of features in one single email.

 

I was trying to use the lookUp Table key:value pair like this:

New Features
<ul>
{{#issueTypes.get("Features")}}
<li><a href="{{url}}">{{Key}}</a> - {{summary}} - {{issueType.name}}
</a></li>{{/}}
</ul>

But this doesn't work. It only works for lookUpIssues but I can't sort by issue type.

Is it possible to take a released version and generate an email that orders the list by issue types?

 

 

2 answers

1 accepted

1 vote
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 22, 2024

Hello @Gil Levy 

Can you please share why are you not using lookupIssues for this?

Also, Can you clarify what do you mean by "sort" by issue type? Do you want to order Features first and then bugs? OR, Do you want to show a list of Features first and then in a different table, show bugs?

Gil Levy May 22, 2024

Because lookupIssues just dumps all the list of issues.

What I was trying to achieve in the email is ordered lists by issue type. For examples:

 

Bug Fixes

[list of Jira bugs that were released in version 1.0]

 

New Features

[List of Jira stories that were released in version 1.0]

 

I couldn't figure out how to achieve this with lookupIssues.

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 22, 2024

Hello @Gil Levy 

You can filter lookupIssues data like below:

 

Bug Fixes

<table border="1">
<tr>
<th style="width:100px">Key</th>
<th style="width:150px">Issue Type</th>
<th style="width:150px">Assignee</th>
<th style="width:150px">Reporter</th>
<th style="width:1000px">Summary</th>
</tr>

{{#lookupIssues}}

 {{#if(equals(issueType.name, "Bug"))}}
<tr>
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{assignee.displayName}}</td>
<td>{{reporter.displayName}}</td>
<td>{{resolved}}</td>
</tr>
{{/}}
{{/}}</table>

-----------------------------------------------------------------

New Features

<table border="1">
<tr>
<th style="width:100px">Key</th>
<th style="width:150px">Issue Type</th>
<th style="width:150px">Assignee</th>
<th style="width:150px">Reporter</th>
<th style="width:1000px">Summary</th>
</tr>

{{#lookupIssues}}

 {{#if(equals(issueType.name, "Feature"))}}
<tr>
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{assignee.displayName}}</td>
<td>{{reporter.displayName}}</td>
<td>{{resolved}}</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 22, 2024

Please note, check is case sensitive. Feature != feature. So please make sure its spelled how its on screen.

if any issues with syntax, please let me know. I just copy/pasted from my other post. Hope it helps. Thanks!

Gil Levy May 22, 2024

@Kalyan Sattaluri amazing!!! I didn't know it was possible. It works!

I did change the <td>{{resolved}}</td> to <td>{{issue.summary}}</td> but that comes up empty.

Additionally, this is unrelated, but I get this email twice... one for each issue type.

I assume it's because I use a branching rule:

image.png

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 22, 2024

Yes, in fact, it would send email for each issue in the version. I dont think you want that.

Just include your lookup and email step as part of regular main branch and delete the branch logic all together.

Please verify and let me know if any concerns.

if looks good, please consider accepting answer so others can benefit.

Thanks!

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 22, 2024

@Gil Levy 

Also, you need to reference it as simply {{summary}} because in the context of {{looupIssues}}, {{issue.summary}} will resolve to NULL.

So once you change <td>{{resolved}}</td> ==> <td>{{summary}}</td> it will work.

*sorry, this was a carry over of me tweaking response for previous post..

Hope it helps.

Gil Levy May 22, 2024

@Kalyan Sattaluri 

I cannot delete the branch because I also have to transition them from Done to a Released status (long story... it has to do with poor integration with Intercom).

 

Automation forces me to either use a JQL or a branching rule.

Gil Levy May 22, 2024

p.s. - the {{summary}} outputs data and time, not the summary.

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 22, 2024

OK. Then I would suggest that inside the branch, just transition the issue. Dont send email yet..

Then come outside of the branch and do lookup and send email..

This way you are only sending1 email.

Regarding => {{summary}} outputs data and time.

 Maybe your "Summary" field is called different?

May have to cross check name of what field you are looking to populate..

Gil Levy May 22, 2024

@Kalyan Sattaluri 

Yes, this is working now as you said, and the summary field is working too.

Is there a way to minimize the gaps in the email?

<h3>The list of issues released in version {{version.name}}:
</h3>

Bug Fixes
<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, "Bug"))}}
<tr>
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{reporter.displayName}}</td>
<td>{{summary}}</td>
</tr>
{{/}}
{{/}}</table>
-----------------------------------------------------------------
New Features
<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, "Story"))}}
<tr>
<td><a href="{{url}}">{{Key}}</a></td>
<td>{{fields.issuetype.name}}</td>
<td>{{reporter.displayName}}</td>
<td>{{fields.summary}}</td>
</tr>
{{/}}
{{/}}</table>

Jira Automation

image.png

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 22, 2024

Hmm. I am not sure of this spacing. I have observed that sometimes email clients also render these emails differently. Same email looks different in native outlook client vs web outlook client vs other providers like Gmail.

If so, you can remove HTML formatting and maybe try other plain text ways..

Like Gil Levy likes this
0 votes
Victor - Modus Create May 31, 2024

Hi @Gil Levy  ,

From my understanding of your request, it seems that you can achieve it with the "Notification Assistant for Jira" plugin:

https://marketplace.atlassian.com/apps/1211069/notification-assistant-for-jira-email?hosting=cloud&tab=overview

It allows to create templates and modify them according to your needs, even with issue lists.

Hope it helps.
Cheers,
Victor

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events