How to copy field values between two custom fields without changing updated date?


Is it possible to copy custom field values without changing the updated date? I know that there is a buil-in script in Script Runner that does it but it doesn't allow to copy values from single select list into text field. And I need just that.

I wanted to use pretty simple script for copying values:

issues.each {
    def cf1 = cfm.getCustomFieldObject('customfield_12187').getValue(it).toString()
    def cf2 = cfm.getCustomFieldObject('customfield_11704')
    issueManager.updateIssue(user, it, EventDispatchOption.DO_NOT_DISPATCH, false)

But it changes Updated Date in each issue and that is very unwelcome for setting in 10k issues that I need to update.

Any ideas how to do it without messing with the database?



1 answer

0 votes

Hello Bartek.

Before recommending you anything, I would advise you create a test project in which to test the two methods I'm about to recommend, so that you don't break anything in case I'm wrong :D

I have asked a senior in my team, and they've recommended you use com.atlassian.jira.issue.IssueManager#updateIssue with the eventDispatcher off. That should not trigger an event, and hence, it shouldn't update the date.

Also, you could test in one testing project the BulkFixResolutions canned script. It shouldn't update the date, but I cannot be 100% sure. Give it a test and let me know if it helped.



Hi Daniel,

As you might see in my question I've used method you metioned and I've already tested it and it doesn't work like that. Indeed it doesn't fire an event but nevertheless it changes the Updated Date. 

And yeah, your built-in scripts can update issues without changing Updated Date but any of the built-in scripts can copy custom field values from single select to text field.

So, still looking for a solution...

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Jira Software

Implementing Jira in Small Business

Introduction This article will give insight on how a small software development department implemented Atlassian products to enhance and streamline the business process. The privately held company h...

314 views 2 8
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you