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?
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}}
Hi!
I just implemented something similar for JIRA/JSM cloud and can share my solution! I hope this answer still helps.:
Type: DateTime Picker
For our purpose we will say the Field name is "First Public Comment"
(only automation should be able to change values)
- Contexts
- Field configuration / Field configuration Schemes
- Screens / Screen Schemes / Work type Screen Schemes
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.
Name e.g. {{ExternalCommentDates}}
Smart Value:
{{#issue.comments}}{{#if(not(internal))}}{{created.jiraDateTime}}~~~{{/}}{{/}}Name e.g. {{OldestExternalComment}}
Smart Value:
{{ExternalCommentDates.split("~~~").first()}}(You DO use logging for easy debugging, right?)
Log message:
Dates: {{ExternalCommentDates}} | Oldest: {{OldestExternalComment}}Choose field to set: First Public Comment
Smartvalue: {{OldestExternalComment}}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.