Send email of all tickets in a release, in one email, through Automation
Asked by zzalowitz:

I would like the version-release functionality to trigger an email to our cloud-ops team to give them a list of all the issues - I tried to set this up, but it sent ONE email per issue, which is non-intuitive if the trigger is the release closing.


Answers:
author: Cat W
body: As others have mentioned, you would use the [Lookup issues action](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Lookup-issues), with the jql   
*fixVersion = {{version.id}}*

The rule itself will look pretty simple:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/173005i7F27D2C27FE9E7AE/image-dimensions/226x306?v=v2 "image.png")

Then you would use the {{lookupIssues}} smart value to return the list of issues in your email and format the output to display the list how you'd like. For example, these will all return a simple list of issue keys; the first two would output a continuous list separated by semicolons, and the last one would be separated by line breaks:

```
{{lookupIssues.key.join("; ")}}

{{#lookupIssues}}{{key}}{{^last}}; {{/}}{{/}}


{{#lookupIssues}}
{{key}}
{{/}}
```

(also check out [Jira smart values - lists](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/) for more ways to use smart values with lists)

You can also use html to display the list in ways that are easier to read. This will output a bulleted list of issues with the issue properties separated by semicolon and the key as a link:

```
<p>Issues released in {{version.name}}</p>
<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}}</a>: {{issueType.name}}; {{summary}}; {{status.name}}; {{resolution.name}}</li>
{{/}}
</ul>
```

But my preferred option is to format it as a table; it's the easiest to read and more aesthetically appealing IMO:

```
<p>Issues released in {{version.name}}</p>
<p></p>
<table cellspacing="1" cellpadding="5" border="0" bgcolor="#aaaaaa">
<tr bgcolor="#ffffff">
<th>Issue</th>
<th>Type</th>
<th>Summary</th>
<th>Status</th>
<th>Resolution</th>
</tr>
{{#lookupIssues}}
<tr bgcolor="#ffffff">
<td><a href="{{url}}">{{key}}</a></td>
<td>{{issueType.name}}</td>
<td>{{summary}}</td>
<td>{{status.name}}</td>
<td>{{resolution.name}}</td>
</tr>
{{/}}
</table>
```

If you do use html to format, make sure you uncheck "Convert line breaks to HTML line breaks" and use \<p\> and \<br\> tags; otherwise, Automation will add an extra line break between each issue.


author: Mykenna Cepek
body: It would help to see the rule you tried to use.

In general, to solve your use case, your rule would use the details outlined [here](https://community.atlassian.com/t5/Jira-Software-questions/Automation-when-version-released-post-release-notes-to-slack/qaq-p/1415084).

I suspect you've already got that much figured out though.

Sending an email in the branch/loop will indeed send one email per issue.

What it sounds like you really want is to aggregate that into some text, and then send that text out *after* the branch/looping in a single email. I'll offer two ideas.

_ _ _ _ _ _ _

Using the [Lookup issues](https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues) action will result in a smart value listing at most 100 issues that match the JQL. I believe the [list.join() smart value function](https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/#Smartvalueslists-list.join-separator-) can aggregate such a list into a single text variable. If all you want is a list of issue keys, that might do it.

If you're looking for something fancier, like an HTML formatted table of issue keys and descriptions -- frankly I'm not sure Automation can do it today.

_ _ _ _ _ _ _

Unfortunately, the current state of Jira Automation isn't great at this type of "aggregation" task. One problem is that the looping executes in multiple parallel branches, causing non-determinism problems. Trying to "build up" a smart value in the loop and use it after the loop simply won't work. This is a known limitation of Automation in Jira as of today.

A possible workaround would be to try to accumulate the text in a text field external to the rule -- examples: in the Description field of a single issue, or as an [entity property](https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Setentityproperty).

I haven't done this, and have concerns that the non-determinism might continue to be a problem with these approaches. If using an issue, liberal use of the "Re-fetch issue data" action might help.

_ _ _ _ _ _ _

Has anyone else come up with a trustworthy workaround to aggregate data like this from the result of an issue query?

comments: author: Bill Sheboy
body: Hi [@zzalowitz](/t5/user/viewprofilepage/user-id/3623815)

Yes, and...to what Mykenna suggests:

Are you using Jira Cloud or Server/Data Center?

* Cloud:
  * You may use JQL with the Lookup Issues action Mykenna's notes to send one email/message for the batch. Please look here for more information: <https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues>
* Server/Data Center:
  * This version does not have lookup issues. Instead you use the bulk handling features of branches (or scheduled triggers) and the {{issues}} smart value for the list. Please look here for more information: <https://confluence.atlassian.com/automation/bulk-handling-of-issues-993924653.html>

Kind regards,  
Bill


author: Anand Inamdar_Amoeboids
body: [@zzalowitz](/t5/user/viewprofilepage/user-id/3623815) if you haven't looked at the Atlassian marketplace yet, there are a bunch of [apps surrounding release notes](https://marketplace.atlassian.com/search?query=release+notes) which should do the desired thing fairly easily.

<br />

PS - I am the Product owner of one such app [Automated release notes for Jira](https://marketplace.atlassian.com/apps/1215431/automated-release-notes-for-jira?hosting=cloud&tab=overview). And if you are on cloud version, there is a [free variant](https://marketplace.atlassian.com/apps/1223567/automated-release-notes-for-jira-free?hosting=cloud&tab=overview) as well.  

Best,  
Anand

comments: author: Erin Quick-Laughlin
body: I will attest to the power of ARNfJ - it's awesome. Used it at a prior startup.

Not only did it help use scale our solution for multiple team's individual needs, I was able to focus on just the standards, and delegate to any developer or Product Owner doing the release (we had various internal / external scenarios).

We also used it to auto-create Confluence pages of the same information, with two different templates: internal kept the hyperlinks to issues and was basic formatting. External (public accessible Space) was fancy, no hyperlinks, and extra fields to explain the basic change to the customer.

We didn't get to a point of integrating with CI/CD, but we could have.

Only reason we don't use it know is we have a dedicated Technical Documentation team (but I still think they would benefit).


Tags: release

release-note