Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

No output using issue.comments.last in Server Automation

Chris Jost January 26, 2025

Hi all,

I'm looking to send an automated email with the hyperlinked key, summary, and the last comment on an issue. I attached a picture of how it is currently set up. However, in my testing, there is nothing returned for the last comment, despite there being plenty of comments on the issues. Can you please help show me where I went wrong!Screenshot 2025-01-26 224148.png

3 answers

1 accepted

3 votes
Answer accepted
Vishal Biyani
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.
January 26, 2025

@Chris Jost 
Since you are using {{issue.comment.last}} inside {{#issues}}, that is one of the problems.

if you take it out and have something like this, it works.

<tr>
<td>{{issue.comment.last.body}}</td>
</tr>

Chris Jost January 27, 2025

Hi Vishal, thank you so much for the reply! Unfortunately that still shows no output: Screenshot 2025-01-27 172843.png
I do have "process all issues in bulk" turned on though

Vishal Biyani
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.
January 27, 2025

@Chris Jost 

Below is the working code. You can adjust the message according to your need. You don't need to use issues.comments as you are iterating via issues already.


The {{issues.size}} issues listed below

<table border="1" cellpadding="2" >
<tbody>
{{#issues}}
<tr>
<td><a href {{url}}>{{key}}</a></td>
<td><a href {{url}}>{{summary}}</a></td>
<td> {{comments.author.displayName}} </td>
<td> {{comments.last.body}} </td>
</tr>
{{/}}

</tbody>
</table>


Thanks @Bill Sheboy for your input

Like # people like this
Chris Jost January 28, 2025

Hi all, this may be a silly question but how can I paste my code within here for future reference? Every time I try it gets formatted automatically. Thank you so much for the support as I'm very new to this!

Bill Sheboy
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.
January 28, 2025

For Rich Text...under the "Formats" dropdown there is a "Code block" option for fixed-font.  Yet that "zaps" spacing when pasted in as text...requiring aligning text.

You could also try the HTML format to see if that helps preserve it better.

2 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2025

Hi Chris - Welcome to the Atlassian Community!

Try {{issue.comments.last.body}}

Chris Jost January 27, 2025

Hi John, unfortunately this still didn't give an output :( I really appreciate your help!!

0 votes
Bill Sheboy
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.
January 27, 2025

Hi @Chris Jost -- Welcome to the Atlassian Community!

Your rule is using the bulk-handling smart value {{issues}} to iterate over the issues found.  Once inside the iterator, just use the field's smart value to access it.

For example:

{{#issues}}
* {{key}} -- {{summary}}: {{comments.last.body}}
{{/}}

 

Kind regards,
Bill

Chris Jost January 27, 2025

Hi Bill, unfortunately comments.last.body did not return any output in my format :( I really appreciate the help!!
Screenshot 2025-01-27 172843.png

Bill Sheboy
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.
January 28, 2025

Please re-read my post and the documentation link I provided...

When inside the iterator {{#issues}} ... {{/}} the issue prefix is not used; instead the scope is the iterator.

Suggest an answer

Log in or Sign up to answer