Jira Script Runner Issue: JQL Query Not Reflecting Comment Update Dates

ravi salamani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 23, 2025

I am encountering an issue with a script that identifies Jira issues not commented on in the last 60 days. The JQL query used is:


project in ("TEST") AND (updated <= -60d) AND status not in (Closed)

The scriptrunner is intended to add a comment to these issues
commentManager.create(issue, user, "Please update your jira", true)

but the JQL results do not reflect the updated comment date. Although the update date appears correctly when checking the issue directly in Jira, it is not reflected in the JQL results.
I have also tried using issueManager.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false), but the update date in the JQL results remains unchanged.
Assistance in resolving this issue would be appreciated.

3 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Kawan Diogo
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 28, 2025

Hi @ravi salamani 

Usually, the EventDispatchOption should work.

However, you can choose to include some functions to force the update event to be triggered.

Some of them include:

import com.atlassian.event.api.EventDispatcher; 

import com.atlassian.jira.event.type.EventType;






EventDispatcher eventDispatcher = ComponentAccessor.getComponent(EventDispatcher.class); 

eventDispatcher.dispatchEvent(new EventType("com.atlassian.jira.event.issue.updated"));

 Or

 

indexManager.reIndex(issue);

 

0 votes
Layssa Souza
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 28, 2025

Hello, @ravi salamani 

 

See if this works for you:

project = "TESTE" AND issueFunction in commented("before -60d") AND status not in (Closed)


This query uses ScriptRunner's commented function, which directly checks the date of comments, ignoring the updated field.

 

Best Regards. 

0 votes
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 23, 2025

Hi @ravi salamani 

 

It looks like you are adding comment but not update a ticket. Please search how to update comment at the end. 

I found quite old page but with some examples how to do this - https://community.atlassian.com/t5/Agile/Three-ways-to-update-an-issue-in-Jira-Java-Api/ba-p/736585

Maybe this will help.

If not, please contact with Adaptavist support.


Regards,

Seba

DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events