JQL Query to Display Last Comment

Andrew Lester February 5, 2019

Hello,

 

I'm using the Jira issue filter in Confluence to display a number of Jira cases and it would be great to be able to pull the last comment posted in each of the Jira cases. Is this possible?

 

Thanks,

Andrew

6 answers

1 accepted

3 votes
Answer accepted
Alexey Matveev
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.
February 5, 2019

Hello,

You need to create a field, which would return the last comment. Then you can show this field in the JQL query results.

But to create this field you would need a plugin.

For example, you could use the Power Scripts add-on:

https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=cloud&tab=overview

The code for such a field would look like this:

Comment cmt = getLastComment("DEMO-1");

return cmt["text"];
Enric Martinez July 20, 2020

So, buy a plugin.

Good answer, but it could also be "write the code yourself" :)

Which is also a good answer and just as good as an alternative way of saying "Sorry, not possible"

Like # people like this
Eshita Seelam September 8, 2021

Hi @Alexey Matveev , thank you for the script using Power Scripts add on.

Is there any way, we can run the script for multiple issues, instead of one issue "Demo 1".

Could you please suggest on this.

0 votes
Penney Nicholas August 8, 2022

In old versions of Jira, it was possible to simply pull Last Comment!

0 votes
Jesus Martinez Areas October 13, 2021

So I was able to achieve this by using the google sheets add-on (NO NEED TO PURCHASE PLUG-IN).

Here are my steps:

1. JQL query in google sheets (my particular case for a specific status): project = "NAME Project" AND status = "In Progress" 

2. Fields: Key, Summary, comment

3.  Apply the following formula to the comments field (in my case is column 'C' and starts at Row 4 and is placed on F4) in order to split all comments into columns

=iferror(arrayformula(split(C4:C,";"))) 

4. Get the number of columns with values from a particular ROW, which translates into the number of comments for each ticket(formula placed on E4).

=counta(F4:4)

5. Get the last comment (index) from a range within a ROW. Previous step provides you this number placed on D4. 

=index(F4:4,1,E4)

6. At this point you will need to constantly add the formula from step 4 and step 5 everytime there is a new ticket however (and still working on this) you can run a script in SHEETS using the Script Editor under TOOLS that auto-populates these formulas everytime there is an update.

 

Tip: Try to use another sheet for all these steps and later display only the columns you require using the query function and other functionalities such as arrays{}.

0 votes
Ernstien Villareal August 15, 2021

This may came late but I have a Python code that can help with this. Needs Jira API. Just disregard the google sheet part, its just there because I want to query the last comments from a list that I have. Code is in my github, https://github.com/ernstgv/JiraGsheetQuery/blob/main/updates.py

Hope it helps.

0 votes
Melissa March 24, 2020

I'm noticing a "lastCommentDate" field in the jira support desk filter options but it's unclear if it actually works. Any updates on this?

0 votes
Marco Brundel
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.
February 13, 2020

Suggest an answer

Log in or Sign up to answer