I need an automation to email the last comment made on a page when status changes
Asked by Paul Rathgeb:

I am trying to create an automation as follows:

1. Status changes.
2. Email is sent
   1. Email contains the last content posted.

I've tried {{comment.last.body}}, {{comment.body}}, {{issues.comment.body}}, {{issues.comment.last.body}}. Everything produces nil. How can I retrieve comments using CQL and/or Smart Values?


Answers:
author: Shawn Doyle - ReleaseTEAM
body: When using the status changed trigger, the smart values that are populated are:

{{page}}

{{content}}

{{space}}

{{priorContentStatus}}

<https://support.atlassian.com/cloud-automation/docs/triggers-in-confluence-automation/#Page-status-changed>

It would seem the only time the smart values for comments are populated is with the trigger Page commented.


author: Shawn Doyle - ReleaseTEAM
body: Confluence would use the following for comments.

Comment properties (page and inline) {#toc-hId--378364356}
----------------------------------------------------------

{{comment}} -- Returns all available comment properties

* {{comment.url}}

* {{comment.id}}

* {{comment.body}}

* {{comment.author.fullName}}

* {{comment.author.publicName}}

* {{comment.author.emailAddress}}

* {{comment.author.timeZone}}

* {{comment.author.accoundId}}

* {{comment.dateAdded}}

* {{comment.dateLastEdited}}

<https://support.atlassian.com/cloud-automation/docs/smart-values-in-confluence-automation/>

comments: author: Paul Rathgeb
body: I used {{comment.body}} and it returns nothing at all - As if there are no comments posted. The same thing for {{comments.last.body}}.

Can you verify if this actually works? If so, why does it not return a value?

More likely, how am I misapplying the smart value?

Thanks


author: Paul Rathgeb
body: Here's an image of the rule:

![Screenshot 2024-04-26 081029.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/320798i6D2C7C237AF81B90/image-size/large?v=v2&px=999 "Screenshot 2024-04-26 081029.jpg")


author: Shawn Doyle - ReleaseTEAM
body: What does the automation look like before you get to the email part? Are you sure your rule is finding something that would have a comment in scope?

I don't think you are misapplying the smartvalue, my guess is that what is being returned by the automation isn't filling out all the smartvalues you expect.


author: Paul Rathgeb
body: The rest of the automation is below. The email is received. I've attached the image below, as well.

![Screenshot 2024-04-26 091405.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/320836i5DD7EB9226F77367/image-size/large?v=v2&px=999 "Screenshot 2024-04-26 091405.jpg")![Screenshot 2024-04-26 091548.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/320837iFA4680A8873B259D/image-size/large?v=v2&px=999 "Screenshot 2024-04-26 091548.jpg")


author: Paul Rathgeb
body: Hi Shawn,  
After reviewing the documentation you sent via email, it seems that I can only display the most current comment when using the "Page commented" trigger. Did I understand this correctly?  
Also, it only works with the structure, {{comment.body}}, and displays the comment that enacted the trigger.  
This is a huge limitation, as it seems reasonable to expect the Smart Value to access (at least) the most recent comment under any circumstance.


author: Shawn Doyle - ReleaseTEAM
body: It would seem the only time the comment smart values are populated are when triggering off the page commented trigger.

I tested it in my instance and can confirm they are empty when trigging off Status changed.


Tags: cloud

confluence-cloud