Send an email with the list of issues matching with a JQL
Asked by Jeremy Derbord:

Hello !

I have a little problem configuring an automation.

I'm trying to send the list of tickets that have the component field empty.

Using the following method, I received the list I wanted, but JIRA sent me over 200 emails. Can you help me?

* Trigger : Scheduled
* Lookup Issues : project = SRXRD and issuetype in (Bug, Story, ReWork) and component IS EMPTY
* Send Email : \<b\>\<u\>List of issues:\</u\>\</b\>

  \<ul\>  
  {{#lookupIssues}}  
  \<li\>\<a href="{{url}}"\>{{key}}\</a\>\</li\>{{/}}  
  \</ul\>

I also wouldlike to request the reporter, issue type and summary, Have i just to replace "{{key}}" for "{{issue.type}}{{key}}{{summary}}, reported by {{reporter.displayName}}" ?

![image.png](/t5/image/serverpage/image-id/303758i1C55AFA13C2FD919/image-dimensions/306x147?v=v2 "image.png")![image.png](/t5/image/serverpage/image-id/303761iC33D5EB2851C207A/image-size/large?v=v2&px=999 "image.png")


Answers:
author: Mark Segall
body: Hi [@Jeremy Derbord](/t5/user/viewprofilepage/user-id/5420075) and welcome to the community!

Since you're using the Lookup Issues action you don't need the additional query in the trigger. Change the Trigger to **Simply run the conditions and actions without providing issues**.

comments: author: Bill Sheboy
body: Hi [@Jeremy Derbord](/t5/user/viewprofilepage/user-id/5420075) -- Welcome to the Atlassian Community!

Yes, and...to Mark's answer:

Some fields like issue type have several attributes. If you wanted the human-readable name for the issue type in your lookup, please use this:

{{issuetype.name}}

To learn more about the smart values and their attributes, please see this documentation: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/>

Kind regards,  
Bill


author: Jeremy Derbord
body: Hi [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637) , hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

Thank you both a lot for your answers. It actually works great !

I have another question, I wouldlike to put the list of stories in form in a \<table\> html attribute. I used :

```
{{#lookupIssues}}
<table>
<tbody>
<tr>
<td><strong>Key;</strong></td>
<td><strong>Resume</strong></td>
<td><strong>Type</strong></td>
<td><strong>Reporter</strong></td>
</tr>
<tr>
<td>{{issue.key}}</td>
<td>{{issue.resume}}</td>
<td>{{issuetype.name}}</td>
<td>{{reporter.displayName}}</td>
</tr>
</tbody>
</table>
```

The mail is blank. I guess I did something wrong ?

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/303998iA7593DE8802EF7B5/image-size/large?v=v2&px=999 "image.png")


author: Mark Segall
body: So there are a couple tweaks:

1. The LookupIssues should be moved down just before your rows
2. When using a smart value list, the header {{lookupIssues}} is implied
3. You need to close out the list

Try this:

```
<table>
<tbody>
<tr>
<td><strong>Key;</strong></td>
<td><strong>Resume</strong></td>
<td><strong>Type</strong></td>
<td><strong>Reporter</strong></td>
</tr>
<tr>
{{#lookupIssues}}
<td>{{key}}</td>
<td>{{resume}}</td>
<td>{{issueType.name}}</td>
<td>{{reporter.displayName}}</td>
{{/}}
</tr>
</tbody>
</table>
```


author: Jeremy Derbord
body: Thank you for your answer [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637), I'm not a developper, sorry for my html level.

I tried your code and apparently it doesn't works.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/304052i597145F40990B2DF/image-size/large?v=v2&px=999 "image.png")

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/304049i5BACD6CB851FBD09/image-size/large?v=v2&px=999 "image.png")


author: Mark Segall
body: I think you can remove the tbody tags from your table and looks like I placed the {{#lookupIssues}} in the wrong place. See if this provides a better result.

```
<table>
<tr>
<td><strong>Key;</strong></td>
<td><strong>Resume</strong></td>
<td><strong>Type</strong></td>
<td><strong>Reporter</strong></td>
</tr>
{{#lookupIssues}}
<tr>
<td>{{key}}</td>
<td>{{resume}}</td>
<td>{{issueType.name}}</td>
<td>{{reporter.displayName}}</td>
</tr>
{{/}}
</table>??
```


author: Jeremy Derbord
body: Thank you [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637) , I've follow your advice and it works better like this.

Have a nice day !


author: Jeremy Derbord
body: Hi [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637) [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) ,

I'd like to thank you once again for the invaluable help you've given me.

Now that the ticket list is working, I'm stuck on the primary objective behind the creation of this topic: to get a list of issues committed at the start of a sprint.

I've changed my manual trigger to "Sprint Started".  
I kept the "Lookup" function to query issues in an open Sprint.

I would like to :  
1/ Get the name of the sprint, its start and end dates, its objective  
2/ Have the table return the issues list that are in the sprint when it is launched.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/304654i55408E4C08F3D7D0/image-dimensions/593x435?v=v2 "image.png")I know that my solution isn't the right one and I'm continuing to look for my own, thanks to the community, although I can't yet find a topic that has dealt with this subject.


author: Bill Sheboy
body: Hi [@Jeremy Derbord](/t5/user/viewprofilepage/user-id/5420075)

Just checking if this answered your question. If so, please mark this one as "answered" to help others find solutions faster. If not...

With the Sprint started trigger, that should be a single sprint value, not a list of values. And so the smart values for your email would be:

{{sprint.name}}  
{{sprint.startDate.jiraDate}}  
etc.

<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-development/#--sprint-->

For the table of issues from the lookup results, what is not working as you expected? Knowing that will help the community to offer more suggestions.

Thanks, and kind regards,  
Bill


Tags: cloud