How do I change the Type of a Custom field?

Simon Ward October 31, 2012

I have a number of custom fields set up as radio buttons, but I need to save space on a page and want to change them to be drop-down lists. I can't see a way of changing them. Do I have to delete and re-create them?

5 answers

1 accepted

2 votes
Answer accepted
Maxim Abramovich October 31, 2012

Hi!

Radio button CF stored in Data Base as Select List Custom Field. You must run next SQL:

UPDATE customfield SET CUSTOMFIELDTYPEKEY = 'com.atlassian.jira.plugin.system.customfieldtypes:select', CUSTOMFIELDSEARCHERKEY = 'com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher' WHERE cfname = '%YOUR CF NAME%'

and restart JIRA. It's simple way

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.
October 31, 2012

Er, no. Do not "restart jira". Stop it before you run the SQL. If you change the database while Jira is running, you could end up with a corrupted dataset because it caches things. Ideally, take a database backup first as well

Simon Ward October 31, 2012

Thanks Nic

Exactly the reason why we don't mess with the DB!

I've re-created the fields as I require them now.

Thanks all

Maxim Abramovich October 31, 2012
Nic Brough, of course. My mistake
Taryck BENSIALI May 26, 2016

Works fine for compatible field type.

don't forget to :

  1. STOP JIRA
  2. Backup DB
  3. Make change on field type
  4. Start JIRA
  5. Change default searcher
  6. Test it's OK
  7. STOP JIRA
  8. Make an other backup
  9. Start JIRA

You should do this first on your DEV or QA system first.

Used to change from one level list to two level list works fine.

Thanks.

2 votes
Faisal
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.
October 31, 2012

Hi Simon,

Apparently it is not possible for us to change a custom field type to other type from within JIRA UI. There's a related feature request been raised to address this feature, however apparently the resolution of the request was set to be Won't Fix:
- https://jira.atlassian.com/browse/JRA-19312

However, there may be a workaround for us which is by modifying the related entries directly in the database. For more details on this, you may refer to the following documentation:
- https://confluence.atlassian.com/display/JIRA/Changing+Custom+Field+Types

I hope that the info helps.

Thanks!

Simon Ward October 31, 2012

Thanks Ahmad.

We try to avoid acting on the database. I think it will be easier to create new fields and drop the old ones from the screens and then delete them. We don't have any behaviours referencing them so it should be simpler to do that as there's only 5 of them.

I just wanted to make sure I wasn't missing an option that would allow this. It seems odd that this is not considered to be a key facility.

Regards

Simon

1 vote
Victor Peters December 10, 2015

It puzzles me why Atlassian hasn't included the option to change Custom Field types. Creating a new one of the desired type means that the values of all existing issues need to be converted or transfered to the new field. And if you have scripts refering to this field (and its unique ID), for example if you synchronize issues betwee HP ALm and JIRA using. Tasktop Sync, you need to alter these scripts to use the unique ID of the newle created field.
Being able to change the custom field type would require much less work on the part of the administrators...

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.
December 10, 2015

It's a low priority or edge case - most JIRA users simply don't need to change the type of a field, and we're mostly yelling for other features.

Richard Clarke June 11, 2019

it might be a low priority, but i believe it is definitely an added feature, as long as the types are compatible.  for example : we want to convert our flat multi-line text to a wiki field type like Description.  WE simply cannot do it, and the work around is to create a new custom field, and iterate across copying existing data to new field.... this is rediculous, cumbersome and in all honesty - a real pain and doesnt really fix the problem, because we have to amend all the screens, disrupt our teams, probably cause issues in sprints/workflows not to mention transitions.  i Fail to see why jira dont see this as an added benefit ?

my only point would be that fields MUST be compatible.  If Not, then a workaround like field copy/merge/replace must be employed as a backup.

Of course im talking about CLOUD.

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.
June 12, 2019

Have you tried changing the field configuration for this field?  The way it is rendered can be swapped between text and rich/wiki in the field config.  Text fields remain the same type underneath.

Like Pascal Scheepers likes this
1 vote
DanielM
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 4, 2013

<script type="text/javascript">
(function($) {
  
 // "customfield_10001" is the number of the custom 
 // multiselect field you want to change as e.g. 
 // seen at the end of the "configure" page url of 
 // the field you want to change this way 
  
    AJS.$("#customfield_10001 option[value='-1']").remove(); //Removes the default value "None"
    function convertMulti(id){
        if (AJS.$('#'+id+"-textarea").length == 0){
            new AJS.MultiSelect({
                element: $("#"+id),
                itemAttrDisplayed: "label",
                errorMessage: AJS.params.multiselectComponentsError
            });
  
        }
    }
  
    AJS.toInit(function(){   
        convertMulti("customfield_10001");
    })
  
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
        AJS.$("#customfield_10001 option[value='-1']").remove();
        convertMulti("customfield_10001");
    });
  
})(AJS.$);
</script>



I have found an easier solution. Just by adding this script to the "Description" of the multi select field you get the functionality of the default JIRA Components field.

0 votes
DanielM
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 30, 2013

Hi, I'm quite new to this community and quite inexperienced. I have a similar question to ask:
I have a multi line field called "Important for clients:", which I want to change to a Label field (if possible). What should my SQL query look like? Is the code below correct?

UPDATE customfield SET CUSTOMFIELDSEARCHERKEY= 'com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher', CUSTOMFIELDSEARCHERKEY = 'com.atlassian.jira.plugin.system.customfieldtypes:label' WHERE cfname = '%Important for clients%'

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.
July 30, 2013

No, that will not work.

The SQL is basically right idea, but you can only convert fields between custom field types that use the same storage methods for their data, and have compatible data. Select, multiselect, radiobutton and checkboxes are one set, short and long text another set. Multiselect and Label are NOT compatible.

DanielM
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 30, 2013

So what should I do to make what I want happen?

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.
July 30, 2013

Create a new multi select field

Run a search for each separate label, or group of labels

Bulk edit each result set to add data to the new multiselect

(I'd look at using the script runner to automate this as much as possible)

Suggest an answer

Log in or Sign up to answer