How to reference the last public service desk comment with smart-value fields

DarkSideMilk January 3, 2019

First the use case: I am trying to create an automation that adds a comment after a help desk issue has been waiting on a customer 13 days and then closes it after 14 days if they don't reply.

I have the structure of the rule created and working for the timing. However I am having trouble with the comment to tell a user their issue will be closed in 24 hours. Because most of our users will see the comment in their email and not click through to view the issue's history I want to have the previous comment that is awaiting their reply in the 24 hours notice comment body. I was going to just use the {{issue.comment.last.body}} smart value, but if the last comment was an internal comment that has information the user/customer shouldn't see, that smart value doesn't filter it and will share it with the customer. So I have been perusing the documentation trying to figure out how I might achieve getting the last public comment instead of just the last comment.

Thus far the only thing I can think of is some if else branches that use the {{comment.getfromend(0).internal}} to test each comment with a compare condition. But no issue will have the same amount of comments and I don't see a way to loop through them in a rule for testing, I do see it for displaying all comments. But perhaps I'm just missing the option or a built in property/smart value I can use to achieve this.

4 answers

1 accepted

3 votes
Answer accepted
Nick Menere
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 3, 2019

Hi JJ,


In order to do this you can utilise another rule to store the last user comment as a property of the issue.

Create a rule like:

  • Issue commented
  • Compare condition that checks if the comment is not internal {{comment.internal}} should Equal false
  • Set Entity property
    • Select issue
    • use the key - lastCustomerComment
    • then store the comment body - {{comment.body}}


The when sending your email you can reference {{}}


Hope that helps.


Nick [Automation for Jira]

DarkSideMilk January 4, 2019

That makes some sense.

I will give that a try

DarkSideMilk February 4, 2019

Sorry for the delay in response, it was a busy January. Finally got a minute to try it. It looks like it will work, but since my automation is meant for closing a customer ticket that has been open for 7 days (commenting at 6 days) it's a bit hard to test. So I'm going to mark this as the answer and return if there are problems. I'm betting there won't be problems.

DarkSideMilk May 30, 2019

So it turns out this isn't working. I figured out I was doing a compare that could never equal so I looked through the documentation and found what looked like a better call under isAfter date functions.

So for example I setup the rule like this (along with a rule for storing the lastPublicCommentDate as the example was given). It keeps saying that a date such as 


is not returning true for being after now minus 3 business days (which I believe should be either 5/27 or 5/24 depending on whether or not that function recognizes holidays automatically, I'm guessin it doesn't) And in either case that date is after 5/22.

I also tried messing with the format of the date and using the toDate function to make sure things were actually dates.

I can't seem to get it to ever evaluate to true. What am I doing wrong?Capture.PNG

Like Rebecca Lüke likes this
DarkSideMilk June 6, 2019

Got an answer in a support ticket with code barrel.

Had to add '.toDate' to my lastPublicCommentDate entity property.

Something that helped a lot was adding a log action before my if/else branch like this one

Property as date: {{}} Eval: {{now.minusBusinessDays(3).isAfter(}}

Like # people like this
1 vote
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 21, 2022

Just adding my $0.02 to this using the newer automation UI


(1) Add a custom field to the Jira project e.g. "LastPublicComment".


(2) Create an automation in the project which triggers whenever a public comment is saved, and saves the desired comment details:


(3) To use the field (e.g. in the automation audit log, or in notifications) just call {{}}

1 vote
Prasad Shiraskar May 7, 2020

I'm writing a Automation Rule wherein I want to copy the External/Public/Customer comment made by the agent on all the linked cases.


I've tried this {{triggerIssue.comment.last.body}} but it copies the comment as internal note. How can I copy it to the "Reply to Customer" section

Prasad Shiraskar May 11, 2020


Johan Eckerstrom - {Eficode} June 6, 2022




Try to switch your condition so you have true or false as your first value to be compared.



0 votes
Johannes Rudolf June 12, 2021

The compare condition that checks if the comment is not internal {{comment.internal}} should Equal false is quite useful for us. However I tried to manage that only the last public comment will be sent either via email or web hook but during my tests with email none the following did work. Am I doing something wrong?







Suggest an answer

Log in or Sign up to answer