Hello Atlassian Community,
I'm trying to set up a Jira automation rule to send email notifications using lookup issues. But I want my email to have a condition that show two different results into the same email :
- If issue priority is "High" and last comment is 5 days ago from now
- If issue priority is "Critical" and last comment was 2 days ago
However, I'm facing an issue where the email is being sent successfully (with no error..), but it doesn't display any issues.
I think I'm missing something using the "if condition" from this documentation :
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/
I found this community post and tried to do the same thing :
https://community.atlassian.com/t5/Jira-Software-questions/Jira-Automation-smart-value-list-for-Parent-items-in-Sprint/qaq-p/2583478
Here is the code i'm trying to make it work and in bold the event I want to do
<p>Hello!</p>
<p> Automated Emails <br> </p>
<h3>High Priority Issues</h3>
<br>
<table style="border-collapse: collapse">
<thead>
<tr style="border:1px solid #e28743; background-color: #e28743">
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px; width:120px">Issue Key</th>
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px">Summary</th>
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px">Priority</th>
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px">Created Date</th>
</tr>
</thead>
<tbody>
{{#lookupIssues}}
{{#if(and(equals(issue.priority.name."High / Critical"), issue.comments.last().created.isBefore(now().minusDays(5))))}}
<tr>
<td style="border:1px solid #e28743; text-align:left; vertical-align:top"> <a href={{url}}> {{key}} </a> </td>
<td style="border:1px solid #e28743; text-align:left; vertical-align:top"> {{summary}} </td>
<td style="border:1px solid #e28743; text-align:left;vertical-align:top"> {{priority.name}} </td>
<td style="border:1px solid #e28743; text-align:left;vertical-align:top"> {{created.jiraDate}} </td>
</tr>
{{/}}{{/}}</tbody>
</table>
<h3>Critical Priority Issues</h3>
<br>
<table style="border-collapse: collapse">
<thead>
<tr style="border:1px solid #e28743; background-color: #e28743">
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px; width:120px">Issue Key</th>
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px">Summary</th>
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px">Priority</th>
<th style="border:1px solid #e28743; text-align:center; vertical-align:center; padding:15px 0px 15px 0px">Created Date</th>
</tr>
</thead>
<tbody>
{{#lookupIssues}}
{{#if(and(equals(issue.priority.name."Highest / Blocker"), issue.comments.last().created.isBefore(now().minusDays(2))))}}
<tr>
<td style="border:1px solid #e28743; text-align:left; vertical-align:top"> <a href={{url}}> {{key}} </a> </td>
<td style="border:1px solid #e28743; text-align:left; vertical-align:top"> {{summary}} </td>
<td style="border:1px solid #e28743; text-align:left;vertical-align:top"> {{priority.name}} </td>
<td style="border:1px solid #e28743; text-align:left;vertical-align:top"> {{created.jiraDate}} </td>
</tr>
{{/}}{{/}}</tbody>
</table>
If you have any idea on how I can resolve this issue !
Thank you very much for your help !
Have a nice day !
Hello @Joseph Hani
Seems like you have few issues with your syntax:
Log below value and see if you are seeing "Condition Passed" as out put if all checks are passed.
{{#lookupIssues}} {{#if(and(equals(priority.name, "High / Critical"), comments.last.created.isBefore(now.minusDays(5))))}} Condition passed {{/}}{{/}}
And then implement it in your email:
Hope it helps.
Hello @Kalyan Sattaluri
Thank you very much for your answer ! You right my syntax was wrong I forgot to not use "issue" when i'm using lookup ...
Now it is perfect ! :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Joseph Hani I have the similiar use case. Could you share the final code that you used to achieve lookup issue with split result (2 tables) by email?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See answer below
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.