Sending due date crossed email using lookup issues in jira automation
Asked by Sameer Mohamed:

Hi Everyone,

I'm trying to send email with Lookupissue function in jira automation.

Lookupissue JQL is able to find the tickets when i hit validate query.

However when i configure the body of the email and run the automation, no issues are listed in the email.

\<table\>  
\<tr\>  
\<th\>Issue Key\</th\>  
\<th\>Assignee Name\</th\>  
\<th\>Due Date\</th\>  
\</tr\>  
{{#lookupIssues}}  
\<tr\>  
\<td\>\<a href="{{url}}"\>{{key}}\</a\>\</td\>  
\<td\>{{fields.assignee.displayName}}\</td\>  
\<td\>{{fields.due}}\</td\>  
\</tr\>  
{{/lookupIssues}}  
\</table\>

Email body looks empty.

Please help me in creating a table and fetch the issues.


Answers:
author: Vikrant Yadav
body: Hi [@Sameer Mohamed](/t5/user/viewprofilepage/user-id/5438085) ,It seems to be an issues in Lookup issue closing tag.

Try below email body , it should work for you.

\<table style="border-collapse: collapse; border: 1px solid black;"\>  
\<thead\>  
\<tr style="border: 1px solid black;"\>  
\<th style="border: 1px solid black;"\>Issue Key\</th\>  
\<th style="border: 1px solid black;"\>Summary\</th\>  
\<th style="border: 1px solid black;"\>Due Date\</th\>  
\<th style="border: 1px solid black;"\>URL\</th\>  
\</tr\>  
\</thead\>  
\<tbody\>  
**{{#lookupIssues}}**   
\<tr\>  
\<td style="border: 1px solid black;"\>{{key}}\</td\>  
\<td style="border: 1px solid black;"\>{{summary}}\</td\>  
\<td style="border: 1px solid black;"\>{{duedate}}\</td\>  
\<td style="border: 1px solid black;"\>{{url}}\</td\>  
\</tr\>  
**{{/}}**   
\</tbody\>  
\</table\>

Result :

![Screenshot 2024-05-31 at 11.31.29?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/327120i7F52576427402D37/image-size/large?v=v2&px=999 "Screenshot 2024-05-31 at 11.31.29?AM.png")

comments: author: Vikrant Yadav
body: ![Screenshot 2024-05-31 at 11.34.11?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/327121iB6D48A999D43ECC1/image-size/large?v=v2&px=999 "Screenshot 2024-05-31 at 11.34.11?AM.png")


author: Sameer Mohamed
body: Thank you [@Vikrant Yadav](/t5/user/viewprofilepage/user-id/1801711) - This works like a charm.


author: Trudy Claspill
body: Hello [@Sameer Mohamed](/t5/user/viewprofilepage/user-id/5438085)

You do not need to preface the fields you want to reference with "fields."

You may also want to look at this older post where there is an answer that provides a sample format.

<https://community.atlassian.com/t5/Jira-questions/Project-Automation-Email/qaq-p/1528912>

Where that example uses #issues you would use #lookupIssues.

Can you also provide screen images that show your entire rule? Sometimes the lack of data in one step is due to the context in which that step is executing. We can't evaluate that without seeing the whole rule.

comments: author: Sameer Mohamed
body: Hi [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011)

Thank you for taking time to lend help. You are right after removing "fields" and correcting the closing tag {{/}}. It is working.


author: Gikku
body: [@Sameer Mohamed](/t5/user/viewprofilepage/user-id/5438085) The code seems to be correct. You can troubleshoot by printing the '{{lookupIssues}}' to audit log as the step just above the send email action (using 'Log action') and check if the expected Jira issues are listed.

comments: author: Sameer Mohamed
body: Thanks for this input [@Gikku](/t5/user/viewprofilepage/user-id/3574315) I will try this.


Tags: automation

cloud

issues

jira-service-management

jira-service-management-cloud

lookup

smart-value