Set Resolved date based on timestamp of last comment with scriptrunner

Ryan Gill March 12, 2024

TL;DR: I want to run a script in scriptrunner to set the Resolved date to be the same as the timestamp of the last comment made on an issue, but am not very experienced with scriptrunner.



Recently we did a large migration from Zendesk to Jira Service Management and imported ~30k issues to JSM.

The "Closed" issues that were imported had no resolution set, which broke our ability to look at created / resolved trends for issues migrated from Zendesk to JSM. Missing the resolution, they also appeared to not be properly closed.

The resolution was set to Done via scriptrunner, but this had the adverse outcome of having all closed issues Resolved date set to be the date the resolution was added, so we have a massive Resolved spike on one day of ~28k issues.

Since we do not have any actual data for Closed Date or Resolved Date from Zendesk, I've come to the conclusion that using the latest Comment date is a good enough approximation of what the Resolved date should be, since we are looking at monthly trends, the date doesn't have to be 100% accurate. 

I am however not very experienced in scriptrunner. 

Has anybody come across a similar challenge to this and able to help?

Thank you


1 answer

1 accepted

0 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 13, 2024

Hi Ryan,

I can confirm unfortunately it will not be possible to set the resolution date, this is because Atlassian do not allow a date to be specified in the rest API when updating the issue API, so this will not be possible to achieve with ScriptRunner for Jira Cloud.

I hope this information helps.



Ryan Gill March 13, 2024

Thank you for confirming that straight from the source at Adaptavist @Kristian Walker _Adaptavist_ 

What it looks like we'll do instead is use a custom chart to check a custom date/time field instead, and use that instead of Resolved date. The custom date/time field will be populated by the timestamp of the latest comment via jira automation. 

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events