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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

226 views 3 0
Join discussion

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