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?

Yes, exactly!

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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

24,003 views 2 7
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