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

Hello,

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')
    it.setCustomFieldValue(cf2,cf1)
    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?

Regards,

Bartek

1 answer

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.

Cheers!

DYelamos

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

158 views 5 9
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