Changing Custom Field Types

Usage FAQ

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

You generally can't shift between custom field types since the data type they store may not match.

Before you begin

Please note that editing the database or any XML backup is not supported by Atlassian.

Always back up your data before performing any modifications to the database. If possible, try your modifications on a test server.

Migrating custom field content manually

One workaround is to use bulk edit operations to migrate content:

(warning) 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.

  1. Create a new field.
  2. Using Advanced Searching, search for all the instances of the old field.
  3. Using a bulk edit operation, populate the new field with the value of the old field for all the issues found. If some issues are closed, you may have to see Allow editing of Closed Issues.
  4. Repeat this process for all values in the field.
  5. Delete the old field, or remove it from the screen scheme.

Upgrading custom fields

There have been changes made to the structure of several custom fields which may have caused this article to be outdated. With that, the below instructions may not work for JIRA versions 4.4+

More details on the field changes found here: Plugin Developer Notes for JIRA 4.4

 

Certain fields can be safely upgraded, such as Version and Select lists to their multiple values counterpart. You can change the "customfieldtypekey" in the "customfield" table to whatever you need it to be. The table below lists the keys for commonly changed fields.

Custom Field Type

Type Key

Single Version

com.atlassian.jira.plugin.system.customfieldtypes:version

Multi Version

com.atlassian.jira.plugin.system.customfieldtypes:multiversion

Single Select

com.atlassian.jira.plugin.system.customfieldtypes:select

Multi Select

com.atlassian.jira.plugin.system.customfieldtypes:multiselect

Multi User

com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker

When moving back from a multi select list a select list, you have to make sure that only one item is selected for each multi select list.

When moving from multi-select to multi-user, you have to ensure that each select-list value is a username (userbase.username value).

For select lists, you also need to update the "customfieldsearcherkey" field to use an appropriate searcher:

  • For multi-selects, it is "com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher"
  • For select lists, use "com.atlassian.jira.plugin.system.customfieldtypes:selectsearcher"
  • For multi-user pickers, use "com.atlassian.jira.plugin.system.customfieldtypes:userpickersearcher"

Examples

For example if you want to update all the version custom fields to become multiple version custom fields, you can use the SQL below.

UPDATE customfield
    SET customfieldtypekey = 'com.atlassian.jira.plugin.system.customfieldtypes:multiversion'
WHERE customfieldtypekey = 'com.atlassian.jira.plugin.system.customfieldtypes:version'

Or if you wanted to convert multi-select-list custom field to a multi-user custom field, first check that all custom field values map to users:

select * from customfieldvalue where id=
    (select id from customfield where cfname='multisel3') and
    stringvalue not in (select username from userbase);
Empty set (0.02 sec)

Then you can change the custom field type:

UPDATE customfield
    SET CUSTOMFIELDTYPEKEY='com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker',
        CUSTOMFIELDSEARCHERKEY='com.atlassian.jira.plugin.system.customfieldtypes:userpickersearcher'
  where cfname='MyMultiSelect';

Or if you wanted to convert text-field custom field to a free-text-field(unlimited text) custom field, first assign the value from stringvalue field to textvalue:

UPDATE customfieldvalue SET textvalue=stringvalue WHERE customfield=(SELECT ID FROM customfield WHERE
customfieldtypekey='com.atlassian.jira.plugin.system.customfieldtypes:textfield' AND cfname='Text Field');

Then, change the custom field type by updating the customfield table as below:

UPDATE customfield SET CUSTOMFIELDTYPEKEY='com.atlassian.jira.plugin.system.customfieldtypes:textarea', CUSTOMFIELDSEARCHERKEY='com.atlassian.jira.plugin.system.customfieldtypes:textsearcher'
where cfname='Text Field';

Restart JIRA. Then reindex (Administration -> Indexing) to update the search index.

Last modified on Jan 9, 2013

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.