Get the Content of the Last Comment

Is it possible to create a script with "ScriptRunner" that runs a "JQL" and displays the last comment of the filtered issues?

1 answer

How would you expect JIRA to show this information?

Actually I would like to analyze the content of the last comment and check if I was mentioned there (@username). I would like to get a list of issues where I was mentioned in the last comment.

It sounds like you're looking to create a JQL function then? You'd like to write a query like issueFunction in mentionedInLatestComment(currentUser()) and be returned a list of issues that match this function?

Steven Behnke Community Champion Jul 21, 2017

You're looking for this ScriptRunner module: https://scriptrunner.adaptavist.com/latest/jira/custom-jql-functions.html

I have created JQL functions to search on Projects, Users, and Versions before, but I haven't tried to extract @mentions from comments.

You're likely going to need to use CommentManager.getLastComment(Issue issue) to obtain the last comment for each issue, then you can use Comment.getBody() to obtain the comment text. Finally, you can parse the content to search for the mention format, which is stored like this: [~username]. Once you extract this, you can compare the mentions to the argument passed to the JQL function.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,345 views 14 20
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot