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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

131 views 5 9
Read article

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