Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Update change history

Hello everyone!

Im trying to update change history in Script Runner->Script Console like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
import java.sql.Timestamp
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.index.IssueIndexingService

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("key")
def changeItems = changeHistoryManager.getChangeItemsForField(issue, "fieldname")
def issueManager = ComponentAccessor.getIssueManager();
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)

log.warn changeItems.get(1).getCreated();

changeItems.get(1).setCreated(new Timestamp(1576655013000))

log.warn changeItems.get(1).getCreated();

issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false);


 In logs i see new date after setCreated but when i check history in issue it's still the same.



2 answers

0 votes

Hi @stepstep 

I think you need to change the EventDispatchOption to ISSUE_UPDATED so that the update is properly registered.

Give it a try and let me know.

Kind regards

Still doesn't work ):

Also tried to use

0 votes

Hi @stepstep 

I misunderstood your question initially I think.

If you're trying to change the "created date" of the issue, I'm afraid this isn't possible via scriptrunner. You'll have to update this via the database.

I could be wrong here, but I don't think Jira allows the modification, so the database would be the only option.

I need to update the date when user made changes (like set another status or cleared field). It is shown in History tab under issue.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you