Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get last public comment date in JSM

Radhika Rajendran
September 18, 2024

I'm using an automation to capture last public comment date. If the latest comment is internal, it's ignoring previous external comments and returning empty. 

{{#issue.comments}}

{{#if(not(internal))}}

{{last.created.jiraDate}}

{{/}}{{/}}

There's a known bug in Jira. The inbuilt 'Last public comment date' custom field gives Last Internal Comment date if the latest comment is internal.

How to get the latest communication date with a customer?

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Tuncay Senturk _Snapbytes_
Community Champion
September 20, 2024

First reversing the comments and then filtering out non-internal comments (not(internal)) will allow us to get the right order. If there is at least one comment, the first one will give us the correct comment.

{{issue.comments.reverse.filter(not(internal)).first.created.jiraDate}}
0 votes
Ludwig Einicke
May 8, 2026

Hi!

I just implemented something similar for JIRA/JSM cloud and can share my solution! I hope this answer still helps.:

 


1) Create a Field

Type: DateTime Picker

For our purpose we will say the Field name is "First Public Comment"

1.1) If necessary: Lock this field from user interaction

(only automation should be able to change values)

1.2) Make sure the field appears where you need it

- Contexts
- Field configuration / Field configuration Schemes
- Screens / Screen Schemes / Work type Screen Schemes

2) Automation setup:

2.1) Trigger

Set your trigger as needed

We will assume that you look at existing issues with potentially lots of Comments.

Small tangent: If the automation gets triggered by a new comment on an item, this gets trivial: Check if triggering comment is NOT internal, Check if field First Public Comment is empty. If both yes get triggering coment created as JiraDate and write to field First Public Comment.

2.2) Add Action: Create Variable

Name e.g. {{ExternalCommentDates}}

Smart Value: 

{{#issue.comments}}{{#if(not(internal))}}{{created.jiraDateTime}}~~~{{/}}{{/}}

2.3) Add Action: Create Variable

Name e.g. {{OldestExternalComment}}

Smart Value:

{{ExternalCommentDates.split("~~~").first()}}

2.4) Add Action: Add value to the audit log

(You DO use logging for easy debugging, right?)

Log message:

Dates: {{ExternalCommentDates}} | Oldest: {{OldestExternalComment}}

2.5) Add Action: Edit work item fields

Choose field to set: First Public Comment

Smartvalue: {{OldestExternalComment}}

 

3) Limitations

External Comments by Customers get counted in this version. For Comment-Triggered automation i would check the author for further details. Here it is more difficult but might not be needed.


Kind regards and best of luck!

 

EDIT: some mistakes

TAGS
AUG Leaders

Atlassian Community Events