How to display Last comment in Filter, JQL and any Add-on.

Follow this short step-by-step guide on how to monitor all the comments, including the last one, using the custom field only.

 

Step 1

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

11.png

 

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, and edit a custom field with the latest Comment.

{
"fields": {
"YOUR FIELD NAME" :"Thanks for raising {{issue.key}}. {{issue.comments.last.body}}"
}
}

 

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

2.png

 

Step 3

Go to JQL search or any add-on (for example Time in Status for Jira Cloud) -> Columns -> Select Last Comment field

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

 

333.png


That’s all!

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

 

Best Regards

SaaSJet Team



28 comments

Comment

Log in or Sign up to comment
Sebastian Torstenson October 20, 2021

Hi!

I am on Jira cloud - standard software project and getting this error:

"Error while parsing additional fields. Not valid JSON.".

Does this only apply for next gen projects?

Zoryana Bohutska _SaaSJet_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 20, 2021

Hi @Sebastian Torstenson 

Where do you want to display data about the last comment? On add-on Time in status for Jira Cloud or on another one? 

To get help from SaaSJet support team contact us here https://saasjet.atlassian.net/servicedesk/customer/portal/1

Sebastian Torstenson October 20, 2021

Hi @Zoryana Bohutska _SaaSJet_ ,

No app actually. Just the normal Jira issue search / filter. We would like to include the last comment in email subscriptions.

Like Martin Holøymoen likes this
Zoryana Bohutska _SaaSJet_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 22, 2021

Hi @Sebastian Torstenson 

Thank you a lot for your comment. There have been mistakes in JSON.

We`ve corrected it, and now you can try again.

But pay attention that in "YOUR FIELD NAME" you should type your custom field.

Best regards

Zoryana

Sebastian Torstenson October 22, 2021

@Zoryana Bohutska _SaaSJet_ 

Thanks for the updated code. It works more or less like intended now. Just one more thing. User codes are not resolved. Example: "Can user [~ account: xxxxxxxxxxxxxxx] fix problem 1". Is it possible to have it written as the actual username?

Zoryana Bohutska _SaaSJet_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 24, 2021

@Sebastian Torstenson imgpsh_fullsize_anim (11).png

Highlighted on the screen - you can edit as you wish. In your case, you need to enter your message and insert such text

{{comment.author.displayName}}

In parentheses - name of the person who commented

But if you want the users tagged in the comment to be deduced in the custom field - they and so will be deduced normally without superfluous actions

Or use just this: Can user {{comment.author.displayName}} fix problem {{issue.key}}

Sebastian Torstenson October 24, 2021

@Zoryana Bohutska _SaaSJet_ 

Thank you! I now use the following code:

{
"fields": {
"Last comment" :"{{comment.author.displayName}}: {{issue.comments.last.body}}"
}
}

This works well as we now know who wrote the last comment. But I did not get how I can get tagged users (@user) to be shown deduced.

Like # people like this
Mr. Mehan December 2, 2021

Thank you for sharing this solution Zoryana Bohutska _SaaSJet it works like a charm for us!  One question, is there a way to run this rule for the first time against all issues within an existing project?  I'm thinking bulk change would help with this, however at the moment it will add a comment of whatever I have specified eg. " ." for the bulk change to occur.  This defeats the purpose of showing the last comment.  Any suggestions is greatly appreciated - thanks !

Eva Ivacekova January 19, 2022

@Zoryana Bohutska _SaaSJet_ I am facing a similar issue as Sebastian - when I tag a specific user in the comment, JIRA reflects the account number as opposed to the name of the user. How can this be fixed? For example "[~accountid:5b33920cc4ac74625bdc0a92] Can we merge this directly to dev to verify?"

Like # people like this
Boyd Hong March 3, 2022

Found the same problem when tagged users are displayed as "[~accountid:%%%%%%%%]". Can someone share the workaround of this pleasE?

Like Sebastian Torstenson likes this
Julia Shcherbyna _SaaSJet_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 1, 2022

Hi @Eva Ivacekova @Boyd Hong !

Have you already solved this problem?
If this is still relevant, please describe in detail your problem, preferably with screens?

Eva Ivacekova April 1, 2022

@Julia Shcherbyna _SaaSJet_ I ended up disabling the last comment feature as it was causing problems (overcrowding the ticket history section).

Sebastian Torstenson April 2, 2022

@Julia Shcherbyna _SaaSJet_ this is still an issue.

Like Ravikiran HM likes this
Nazarii Tsymbrak April 21, 2022

Hi. @Sebastian Torstenson , @Boyd Hong I think this code should solve your problem     

 

[~accountid:{{comment.author}}] 

Markus Pöhler April 22, 2022

Hi all,

in the Edit Field Action I am missing the "MORE OPTIONS" - so all I can do is add the "code" into the text fields content, but then it is stored as text and not working.

Same for multiline or single line custom fields.

Any hints?

Thanks

PS: I am on JIRA DC 8.20.7 

christine_stpierre June 21, 2022

How can I address the following;
user-added a comment, but then shortly after they updated it with more information - the last comment field is not capturing this change

Karolina Wons_SaaSJet
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.
July 4, 2022

Hello @christine_stpierre  @Markus Pöhler  @Sebastian Torstenson 

We have posted a new updated version of this article. So you can find the necessary information here: https://community.atlassian.com/t5/Marketplace-Apps-Integrations/How-to-get-last-comment-in-filter-or-JQL/ba-p/2066357#M4598

Hope, you find ut helpful

 

Regards

Like Markus Pöhler likes this
Louise Woods September 23, 2022

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

Mark Francisco October 19, 2022

Hi - Does this feature available for JIRA server instance?

Lucy Warner_SaaSJet
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.
November 1, 2022

@Mark Francisco Unfortunately this add-on is not available for Jira Server yet, but we will take into account your suggestion.

Carl Palmquist November 2, 2022

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

Emil Moses November 26, 2022

@Zoryana Bohutska _SaaSJet_

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

Like Adam_Sterrie likes this
Eduardo January 19, 2023

To make these changes, is there a plug-in necessary or not?

I understand that it is only customizing directly in Jira... putting the JSON and that's it. Right?

Karolina Wons_SaaSJet
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.
January 19, 2023

@Eduardo Miguel Montaño Ortí welcome to the community!

 

Time in Status for Jira Cloud is a recommendation to use, but you can use automation without the add-on.

Like Eduardo likes this
Oscar Sanchez March 1, 2023

Buenos Días:

Es posible insertar en el campo todos los comentarios de una incidencia ? para luego mostrarlos en un filtro?

TAGS
AUG Leaders

Atlassian Community Events