How can I programmatically add a comment without chaging updated date?

Paul Tiseo
Contributor
June 5, 2018

How can I add a comment to an issue (in this particular case via ScriptRunner) without impacting the Updated field? Basically, I use "issueInputParameters.setComment()", but that seems to change the updated date. Also, tried

def oldUpdated = issue.getUpdated()
issueInputParameters.setComment('stuff')
issue.setUpdated(oldUpdated)

 

3 answers

1 accepted

1 vote
Answer accepted
Roland Holban (Adaptavist)
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.
June 5, 2018

You cannot. The IssueUpdatedEvent will fire every time.

With that said, you could avoid the event if you went low-level enough (i.e. re-implement what JIRA does but just omit the event-firing code). But of course this is no easy feat

Paul Tiseo
Contributor
June 6, 2018

So, my goal was to use an "escalation service" in ScriptRunner to notify users of ServiceDesk tickets that are 6 days not updated, i.e. category = ServiceDesk AND updated < -6d AND status = "Waiting for customer". Then, requery those that are updated < -7d for an auto-close. However, is doing a issueInputParameters.setComment('stuff'), I mess up the updated date. Any ideas?

0 votes
Kevin Buckley
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 28, 2025

This seems as though it would be (would have been?) a really
useful feature (so therefore not one ever likely to make it into
production?)

Issue, as manifested within our instance, is that some people,
not involved in soving any given issue, insist on asking for
"details of any updates" on an issue, which then changes the
Updated date, so as to make it look as though there HAS been
a "technical" Update, in respect of the actual issue - Deep Sorrow!

As welll as the two existing classes of comment

Add internal note
Reply to Customer

which merely trigger different distribution lists, it would
be really useful to have some kind of say,

Administrivia

comment class, that wouldn't change the Updated date/time,
along with, perhaps, an additional "date/time" field  that
would track the administrivia updates for the people who
want to track that "non-technical" info.

0 votes
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 5, 2018

I doubt you can. It probably records the data/time the database is updated. Have you seen any update that isn't reflected in the updated date? 

Paul Tiseo
Contributor
June 5, 2018

Strange that the API provides a setter but it seems to either ignore it, or setting the update date to a specific value sets the update date again to the current date?

Suggest an answer

Log in or Sign up to answer