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,293,291
Community Members
 
Community Events
165
Community Groups

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



16 comments

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?

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

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

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

@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?

@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}}

@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 bertrand_drouhard likes this

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 !

@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

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

Like Sebastian Torstenson likes this

Hi @Eva Ivacekova @Somnuek Hongcharoenkul !

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

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

Hi. @Sebastian Torstenson , @Somnuek Hongcharoenkul I think this code should solve your problem     

 

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

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 

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

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

329 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you