Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

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

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.

3 answers

1 accepted

2 votes
Answer accepted

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]

That makes some sense.

I will give that a try

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.

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

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

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?







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




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



Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you