A way to bulk copy custom field values from one custom field to another.

Jeremy Test
Contributor
March 19, 2012

Everyone:

I have a situation where a client has a number of custom fields that need updating to different custom field types. I would prefer to stay out of the database or do project exports, although willing to do it if that is the only option.

Basically the client has successfully been using JIRA for quite some time, but some of the custom fields should be updated to meet newer requirements. For example one field that was only used for numbers before, now should be changed to a text field to bring in additional input.

I can create the second field, but the problem is they have ~400 issues that have values in the current field that will not be in the new field. Since they are not always the same value (where I can bulk edit things over to the new field), I am thinking it would be nice to copy from one field to another.

Another option might be to change the field type (number --> text), although that doesn't seem to be a good option either.

If anyone has any good ideas of some options that would be great.

Respectfully,

Jeremy Neuharth

7 answers

2 accepted

44 votes
Answer accepted
Tyler C. Borg
Contributor
November 24, 2015

This method can be used without any add-ons or plugins tested on JIRA OnDemand (Cloud). Also note you can probably use excel format for import but I prefer CSV. I tested this first by creating 3 issues before updating live data, I would suggest you do the same to become comfortable with the process. JIRA Administrator rights are needed for this method.

  1. Go to Search for Issues in JIRA.
  2. Identify all the issues you wish to update.
  3. Adjust the columns to show your summary, issue key, and field with values(Due) to use.
  4. Click export and select a format, for this example Excel (current fields).
  5. Clean up the file, removing unnecessary columns, and everything but the header and data rows (export adds extra rows of footer/header content).
  6. Go to JIRA Administration drop-down and select "System".
  7. On the left pane under the heading "Import and Export" select "External System Import".
  8. Choose CSV.
  9. Choose file and select your CSV.
  10. Select your project. Note you may need to adjust date format at this step.
  11. Map your fields. You must have issue key and summary!
    1. Issue Key (CSV field) => issue key (JIRA field).
    2. Summary (CSV field) => Summary (JIRA field).
    3. Field to use values (CSV field) => Field to update values (JIRA field). In my case it is "Due Date" => "Original Due Date".
  12. Click next and it will perform the update and indicate the result.

Melanie Binks November 24, 2015

You may have just made my week by that message!! I had no idea you could import to update issues that easily! Just tested and it works wonders .. thank you SO much!! We did end up managing to get the topic working above .. but your instructions will helps us out with sooooo many other things, thank you again :)

David Hergert _PAYX_
Contributor
December 28, 2015

@Tyler C. Borg - did you mean to say "Summary (CSV field) => summary (JIRA field)"? Do you even need the Summary field, could you get away with just Issue Key and Field To Copy?

Tyler C. Borg
Contributor
December 28, 2015

@David Hergert thanks for catching that typo, I edited it. Yes the summary is required even when updating.

Susanne Nordholm April 11, 2016

Is it possible to do the update and still keep old value too? That is, is it possible to append the new value to the old value?

Ofer Prat May 26, 2016

@Susanne Nordholm - Sure, do whatever manipulations you want in the CSV file.

@Tyler C. Borg - thanks a ton for this tip - I am embarrassed to say that after years of importing from CSV I didn't know you can update...

Deepali Bagul
Contributor
February 9, 2017

Thanks a lot. You made my day smile This worked for me when tried to copy from custom text field to custom select list field whereas script runner didn't worked for copying values from for two different custom field types..

pokalav
Contributor
March 14, 2017

I have one doubt following the CSV importing way. But issuekey is diffrent after importation users are confused.

Erick Miranda
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2018

Thanks great solution.

Kristin Bitler
Contributor
March 23, 2018

ScriptRunner failed (see attached) but your solution worked. Thank you!

 

 

Screen Shot 2018-03-23 at 11.33.13 AM.png

Like StudiDuell likes this
Anna Bozhko March 28, 2018

Hello!

This solutions is described as one that updates data, but I've tried and new JIRA items were created. 

Help me please, what I'm doing wrong?

Thanks!

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2018

Probably mismatched keys.

Anna Bozhko March 28, 2018

Thanks @Nic Brough -Adaptavist-, you gave me an idea.. so

I've found what was wrong!

First of all I've read again Tips for importing CSV data into Jira fields.. 

Issue Key - You can set the issue key for an imported issue. If an issue with a given key already exists in Jira, it will be updated instead.

The problem was that when you try to do import directly from search result page - there is no mapping field = Jira Key.. and it didn't work with issue id

tmp.png

But when you do it from Jira Admin..->System - there is Jira Key field.

 

So the solution works as expected.

Many thanks!

Like # people like this
Thomas Fraser
Contributor
January 23, 2019

I was about to ask if there's a way to do this for multiple projects then saw @Anna Bozhko's comment.

 

In Jira Cloud, Using the 'import from CSV' option from a search page forces you to specify a single project to import to, however going to the 'external system import' via the admin menu gives you the option to specify the project in the CSV.

Deleted user August 14, 2019

WARNING: Depending on which version of JIRA you are running, importing via csv will likely add users to the "Developers" role, per https://jira.atlassian.com/browse/JRASERVER-64769.

I was bitten, so I'm sharing my experience. Also, be very careful of the import itself. As mentioned above, you must have the issue key and summary. For my import, the following fields were required:

  • Issue key
  • Issue id
  • Project key
  • Project name
  • Project type
  • Customfield (This is the field you want to paste copied data into from the original custom field)
  • Summary

I did this with several smaller csv files, in chunks at a time. CHECK to make absolutely sure the "Summary" of the imported data matches the "Summary" of the target issues you intend to update. The import will overwrite the Summary. So long as they match, this isn't a problem. 

Smita September 20, 2019

I have a challenge there Tylor. I have an OOTB column named Description ( wiki style renderer ) , I want to copy that to another field named DescriptionN ( wiki style renderer )

and then hide the original OOTB column .

 

When i do this on JIRA cloud , using the way you have mentioned above - I lose the rendering. 

Not sure How to accomplish this , if you have any solution, please share

Abdullah Jaafri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 18, 2019

thanks a lot for such a clear answer 

Liz Bedwell
Contributor
July 30, 2020

Thank you this has saved a huge headache where a user was able to add in a custom field with the exact same name as a Jira default field causing data to be split across different areas and us unable to see which was the right one when using tools such as Advanced Roadmap and Automation Rules!

11 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2012

Try the copy custom field values script from the script runner plugin. This will handle a bunch of conversions, and doesn't need any downtime. So you would create a new field, copy the values, delete the old field, and optionally rename the new field.

Some conversions you can do by changing the database customfieldtype table, but number to text is not one of those, because the storage is different.

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 19, 2012

The script runner script has two problems: both fields have to be custom. You cannot merge two fields.

So if you have two description fields and want to merge then you have to code.

Andy D April 25, 2013

Jamie, I tried that built-in script, but was unsuccessful in copy a number custom field into a text custom field.

Error was:java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String

Any ideas?

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2013

Not all conversions are supported - you could modify the code to put the cast in...

2 votes
Lisa Wright
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 23, 2015

Any way to do this with the Cloud version of Jira? The script runner plugin is not available.

Melanie Binks November 1, 2015

I'd like to know this too :/

1 vote
Marlene Cote October 15, 2015

this script runner script won't work between these 2 field types, label and URL.

 

A November 8, 2015

How would you convert from a label to a url, or are you talking about the converse?

0 votes
SABVARX
Contributor
March 29, 2015

Thanks for the hint to use the copy custom field values script from the script runner plugin. It worked fine as well for migration of custom field values of type "Date Time" to type "Date" .

0 votes
Marta Lopez Reyes _UOC_ July 1, 2014

Ohh just that I have never used the copy custom field values script from the script runner plugin. :(

As your last answer was last year I thought that probably there's a new way to perform it.

Thanks!

0 votes
Marta Lopez Reyes _UOC_ June 30, 2014

Do you have any new solution? :)

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2014

What's wrong with the old solution?

Like Karan Mathur likes this

Suggest an answer

Log in or Sign up to answer