Forums

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

How to find smart value for last edited comment for automation rule??

Nishit Popat March 22, 2022

I want to find last edited comment : Currently I am using {{issue.comment.last.body}} but it is giving me last created comment.

But I want to use last edited comment for my project.

Anyone knows how to find this??

2 answers

2 accepted

0 votes
Answer accepted
Bill Sheboy
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.
March 22, 2022

Hi @Nishit Popat -- Welcome to the Atlassian Community!

As you have asked the question, I do not believe it is possible within an Automation for Jira rule.

The smart value of interest for your use case is {{issue.comments.updated}} and the comment you want is {{issue.comments.updated.max}} from the list.

I can think of a couple of limitations for the built-in features that prevent getting the associated comment:

  • JQL does not allow sorting on the attributes of a comment, preventing an ORDER BY to help
  • Smart value list filtering does not allow use of a created variable or a nested list to compare for the maximum updated date.

A possible work-around would be to trigger on issue updated and to detect a comment edit with the changelog, then save that date/time and comment for later use in a custom field.

Kind regards,
Bill

0 votes
Answer accepted
Rafael Costa
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.
March 22, 2022

I think this will help you:

 

import com.atlassian.jira.component.ComponentAccessor

def commentMgr = ComponentAccessor.getCommentManager()
def commentsUpdated = (commentMgr.getComments(issue).findAll {it.updated > it.created})
def lastCommentUpdated = commentsUpdated.sort{it.updated}.last()

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events