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

Smart Value Logic for Excluding first Comment


Hello wonderful, knowledgeable people. 

I have been asked by management to extend our customer comment notifications to include the history of all the comments for the ticket. 

The default notification covers the last comment just fine with:

*${} commented:*



Beyond this, I now want to include the rest of the comments in reverse order. That part is pretty easy. However, since the last comment is already included above, I wanted to avoid including that one a second time and just start with all the comments after the last one. After working with it for an hour, below is what I came up with but it doesn't work. Any ideas what I am doing wrong?

*Comment History:*

{{#if(not(equals(issue.comments.last.body, body)))}}
*{{author.displayName}}* on *{{created.convertToTimeZone("America/Los_Angeles").jiraDate}}* at *{{created.convertToTimeZone("America/Los_Angeles").shortTime}}*



2 answers

1 accepted

Good news and bad new as it turns out. 

The good news is that I figured out how to do it with information from the section called "Combined function examples" on this page:

So the answer is basically this: 

*Comment History:*

*{{author.displayName}}* on *{{created.convertToTimeZone("America/Los_Angeles").jiraDate}}* at *{{created.convertToTimeZone("America/Los_Angeles").shortTime}}*


This would be great, but as it turns out, the customer notification system in Jira is REALLY terrible. You apparently can't use smart values despite the existence of "variables". So unless I want to try and recreate a customer notification (along with CSS styles and everything) in automation, which would still come from the automation email address, I guess I have to give up this dream of giving our customers useful context in their notifications. I found this suggestion that is worth voting on but even that probably won't fix it.

Situation is terrible. 

0 votes
Carlos Faddul Community Leader Aug 20, 2022

Hi @Chris Riffey , but this is a Customer Notifications right ?

The customer notifications are trigger basead on events.

Smart values it is not the best way to show all history of ticket comments.

Why don't you trigger an automation once a day, sending the email containing the entire comment history?

This way, it would decrease the amount of repeated notifications and history that the customer receives.

Hey Carlos, thanks for the response. I don't see how this solution would reduce repeat notifications. It sounds like it would increase it by having the customer regularly receive emails even if nothing changes in the case. 

I want it to be trigger-based as it is now so they only get notified when something changes in the case (ex when an agent comments to them). What I am after is a way to give them more context on the comment they are getting at that time. The default notification only shows the most recent agent comment, not even what they are commenting on. So if the agent says something like "yes, we can do the second thing you suggested, just tell me when you are ready", it is not readily apparent what "the second thing" is to the customer. Especially, if the case has not had any activity in a few days or if they are dealing with multiple cases as many of our power customers do. 

I want to show the customer, along with the most recent comment, the comments that came before so they have the context all in one place. I already have that part working with the section contained within:



My only remaining issue is I want the most recent comment to be removed from that section because it is already being written at the top of message and it seems messy to have it written a second time below. I'd rather the first thing below is the second to last comment which would be the one the agent is likely responding to. Heck, even if I just had that one it would be helpful. 

I feel like there is probably a straightforward answer, I just don't know enough about all the ins and out of smart values. I am assuming my problem is the "equals" comparison I am doing and I don't know how to address the "this" comment (the one currently being iterated through in the #issue.comments.reverse section). Does anyone know? 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

An unofficial way to monitor a JSM mail handler for errors

...eturns true if any content is returned for the s...

668 views 3 20
Read article

Atlassian Community Events