Change custom field type from text field to numbric field

Louis Sun August 20, 2013

Dears,

Does anyone have some ideas how to change custom field ype?

I went through https://confluence.atlassian.com/display/JIRA052/Changing+Custom+Field+Types

Unfortunately, we just fall into "Please note that this workaround is only applicable when you have many issues containing the same custom field value. As a scenario let's say you have 100 issues, and each issue have different value for the custom field, it will be very difficult for you to perform the migration by using the steps below."
We have almost 1000 issues in JIRA now. Those issues have different values for the custom field: Weight. We want to change it from Text Field to Number Field and keep value no missing/overriden. Any solution for this kind of situation?

Upgrading custom fields is for Single Version, Multi Version, Single Select, Multi Select, Multi User. I didn't see any more details address my situation.

Does anyone help? Thank you very much.

4 answers

1 accepted

0 votes
Answer accepted
Louis Sun August 20, 2013

Thank you for your quick reply, rambanam prasad and Nic Brough

@Nic Brough, could you explain with more details to use bulk edit method: copy old text field value to new number field? I do need to keep those values(they are number like 996, 98 but in text field for the moment). When use bulk edit I just see the option to input new value, this will overwrite my different values with the same value. Thank you very much for your help.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2013

Sorry, I wasn't clear there. Bulk edit can only set one value at a time, but on a range of issues. So you'd have to analyse your number values and potentially make hundreds or thousands of edits.

That's also why I mentioned the script runner. If my analysis says I've only got a tiny handful of values (like they're all going to end up as 1, 2, 4, 8 or 16 in the new field), I'd bulk edit. If it turns out I've got 1000 different numbers on 1000 different issues, then I'd be reaching for scripting of some sort.

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2013

The document you have found also has the problem that you can't change between field types that store their data differently. Text fields store text, and number fields store numbers, so you really do not have an easy migration here. "Changing type" is basically inappropriate and you have a migration to do.

What I would do:

  • Rename the current numeric field
  • Add a new text field
  • Use either bulk edit, or SQL to copy the numeric data into the new field from the old one (script runner might do it too if you have that)
  • Delete the old field when you're happy with the new one

Note that if you stick with "change field type", the process is

  • SQL to change the field type
  • SQL to take all the values from the number storage and move it to string storage in the customfieldvalue table (or, in other words, a "bulk edit")
0 votes
Louis Sun August 21, 2013

I see. much appreciated. I would consider which method I should apply. Thank you very much.

0 votes
RambanamP
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.
August 20, 2013

i am not sure how to do it exactly, but the following post may help you check this

https://answers.atlassian.com/questions/102209/how-do-i-change-the-type-of-a-custom-field

Suggest an answer

Log in or Sign up to answer