Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,825
Community Members
 
Community Events
176
Community Groups

How to get last comment in filter or JQL?

Do you want to monitor the last comment added to the issue? If you're a Jira user and it’s essential for you to get to know who and when has added the last comment, follow this short step-by-step guide.

LinkedIn (12).jpg

Step 1

First of all, you need to create a new custom field in the project for every Issue type. Type the name “Last Comment” for a custom field and choose the “Paragraph” type (as it is displayed in the screenshots below).

How to get last comment 1.1.png

Note: You should perform a step with adding a Custom field for each Issue Type (in our case these are e.g. Bug, Task, and Story as it's shown on  the screenshot)

Step 2

Then start the Automation process. Here’s what you should do:

Go to Project -> Setting-> Apps-> Project Automation -> Create rule

You can start when the Issue is Commented on and edit a custom field with the latest Comment. 

{

"fields": {

"Last Comment" :"[~accountid:{{comment.author}}] commented: {{issue.comments.last.body}}"

 }

}

2.1.png

Note:

  1.  Last Comment (highlighted in red color)  is a field name. If you name your field differently, please, specify the correct field name there. 
  2. You can format the text template based on which the message will be formed (highlighted in yellow). Copy the pattern from the example and  mention the author of the comment: [~accountid:{{comment.author}}] and display the text of a comment - {{issue.comments.last.body}}

Look at the screenshot below to get a clear view of how to do that properly.

 How to get last comment 2.2.png

Step 3

Go to JQL or native search, or any add-on.

 (for example Time in Status for Jira Cloud) -> Columns -> Select Last Comment field

As a result, you will see the custom field you have created with the latest value.

 How to get last comment 7.7.png

That’s all!

Now you know how to display the last comment in the filter, JQL, or any add-on too. 

If you want to track the time frames and team efficiency in your workflow process in a single safe place, you can try the Time in Status for Jira Cloud add-on. It helps to identify bottlenecks, prevent delays and increase work effectiveness. Have any doubts? Try it on the Atlassian Marketplace and enjoy the results. Your team will be fully satisfied with the provided functionality. 

Best Regards

SaaSJet Team

13 comments

Thanks for this. Without this article I wouldn't have been able to get this working.

 

However I couldn't get the above to work, I needed the following:

 

{
"fields": {
"customfield_10XXX" : "{{issue.comments.last.body}}"

}}

Thanks for the article!

In ended up using the same code Chris posted.

However, is there any way to keep the original formatting of the comment?

E.g. including bullet points, maybe even links to other issues, etc.

Thanks really helpful article! 

Just wondering if there is a way for just the user display name and comment to appear than the script part showing as well in the filter ?Capture - Last Comment.PNG

@Louise Woods Mine does not show the JSON brackets. Just a couple of thoughts:

  1. You could switch out the Last Comment in the code with the customfield_XXXXXX name.
  2. Disable the current automation and create a new one from scratch following the instructions.

Chris Thomas Thanks for your help it I have worked it out!

when I tag a specific user in the comment, JIRA reflects the account number as opposed to the name of the user in the 'Last Comment' field  How can this be fixed?

For example

most recent Comment :  (@ jane smith) can we rename the report?

Comes up in Last Comment in filters and dashboards as :

accountid:12345:123xx123-xx5x-4141-x05x-715x9100x1x8 can we rename the report?

Thanks for all this! Super useful, how would the code look like if I wanted to also add the Date when the last comment was made? in a YYYY-MM-DD or similar

Hi @LaurenS ,

 

were you able to fix that? same problem here.

Thank you

@Tomas Arguinzones nope, haven't been able to figure it out

Hi @LaurenS 

I just figured it out!

Just change the renderer in the field configuration scheme for the field from free text to wiki style and it did the trick!

Like Chris Thomas likes this

Hi @Tomas Arguinzones  @LaurenS 

Tried to not resolved in last comment 

free text to wiki style received account id : 

Hi [~accountid:62c6c10a5f45fds3d3b7b76f5a] ,

Issue resolved please verify ,

Screenshot 2022-11-06 225058.jpg

issue resolved! thank you very much @Tomas Arguinzones 

@LaurenS 

Can you please let me know how did you resolved am still getting the same issue 

Hi [~accountid:62c6c10a5f45fds3d3b7b76f5a] ,

Issue resolved please verify ,

If anyone tagged in the last comment it only gives me there iD 

{{issue.comments.last.body}}

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events