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,359,779
Community Members
 
Community Events
168
Community Groups

JQL Query to Display Last Comment

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

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"];

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

Hi @Alexey Matveev _Appfire_ , 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

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

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{}.

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.

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?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

4,955 views 18 31
Read article

Atlassian Community Events