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
Community Members
Community Events
Community Groups

Update System Field Without Updating History

Does anyone know how via groovy I can update in bulk a ton if ticket without it affecting the Last Updated date field. I have the below code that DOES update the last updated date.

Can you please help me figure this out.

Thank you!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.user.ApplicationUser

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def issueManager = ComponentAccessor.getIssueManager()

def ProjectKeytoUpdate = "TPA"

for (int key = 22104; key <=22104; key++) {
Issue issueObject = issueManager.getIssueObject(ProjectKeytoUpdate + "-" + key)

if(issueObject && issueObject.key.take(ProjectKeytoUpdate.length()) == ProjectKeytoUpdate){

CustomField RequesterField = customFieldManager.getCustomFieldObjects(issueObject).find { == "Requester"}

ApplicationUser RequesterUser = issueObject.getCustomFieldValue(RequesterField) as ApplicationUser

ApplicationUser ReporterUser = issueObject.reporter as ApplicationUser

if (ReporterUser != RequesterUser){

issueManager.updateIssue(RequesterUser, issueObject, EventDispatchOption.DO_NOT_DISPATCH, false)

def changeHolder = new DefaultIssueChangeHolder()

log.warn issueObject.key + " | Copyed field " + + " to Reporter with value of " + RequesterUser + " (Orignal Reporter Value: " + ReporterUser + ")"
}catch (all){
log.warn issueObject.key + " | Failed to copy field " + + " to Reporter with value of " + RequesterUser
} else {
log.warn issueObject.key + " | Fields have the same values. Requester: " + RequesterUser + " to Reporter with value of " + RequesterUser + " (Orignal Reporter Value: " + ReporterUser + ")"


It is my understanding that I should be using the below code to do so but this is to update a custom field and not a system field.

// custom field reference
CustomField myCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(MY_CUSTOM_FIELD_ID);

// construct the new value
ModifiedValue newValue = new ModifiedValue(issue.getCustomFieldValue(myCustomField), "new value");
// update the field to "new value"
myCustomField.updateValue(null, issue, newValue, new DefaultIssueChangeHolder());

2 answers

1 accepted

1 vote
Answer accepted

So I opened a ticket with Atlassian and Adaptavist. Basically the answer is that this can't be done through scripting. Since the Reporter field is tied to the ticket itself if you update the field you update the ticket. Since custom fields are there own identify and just liked to the ticket you can update the field without updating the ticket itself.

At the end of the day, I updated the database and then ran a re-index on the tickets that I updated. (I provided the code below. (But if you need to use my code to copy my work, then maybe you shouldn't be updating the database.))

Answer from Adaptavist:

I understand that you like to bulk update the system field value on Jira issues without updating the issue history and the Updated Date. Please correct me if I'm wrong.

The sample script in our library here shows bulk updating the value of the system field for all issues returned by a JQL query, but it's updating the issue history as well.

To update the system field without updating the issue history, the alternative I could think of is using the method, which is deprecated. You can refer to the sample script in this community post.


Atlassian provides few ways to update an issue using Jira Java API. Each method will save the changes to the history, except for the CustomField.updateValue() method, while this method updates the issue instead of stores the issue in the data store. However, as you're aware, this method can be used for setting custom fields' values only.

Here is the simple comparison between the Java API methods for your references:

Jira Java API to update issues


You can set the values of the system fields and the custom fields with this method, and the changes will be saved to the issue history. This method stores the provided issue to the Jira datastore and performs no permission checks. 


You can only set the values of the custom fields with this method while the changes will not be saved to the issue history. This method updates the issue in the data store.


You can set the values of the system fields and the custom fields with this method, and the changes will be saved to the issue history. This method stores the provided issue to the Jira datastore. 

This method makes sure that all of Jira's business rules are enforced in which the permissions and data validation will be checked, proper events will be fired, and notifications will be triggered when dealing with Jira Issue's. 



-- SELECT ji.ID as 'Ticket ID', p.pkey, CONCAT(p.pkey,'-',ji.issuenum) AS 'Ticket Number', ji.REPORTER, cfv.STRINGVALUE AS 'Requester'
[Jira].[dbo].[jiraissue] ji
INNER JOIN [Jira].[dbo].[project] p
INNER JOIN [Jira].[dbo].[customfieldvalue] cfv
ON cfv.ISSUE =
INNER JOIN [Jira].[dbo].[customfield] cf
p.pkey in ('xxx')
and cf.ID = 10307
and = cfv.ISSUE
and cfv.STRINGVALUE is not null


Thanks for the detailed answer.

Hi @Joshua Kohn I know about oldschool method which stores an issue. I have no idea whether it updates the Updated date and it is deprecated but if you're on test environment, just give it a try and let me know :)

You should remove issueManager.updateIssue of course.

Suggest an answer

Log in or Sign up to answer