Why migrate data in issue fields to a custom field?
Sometimes you have configured you system wrong, and realise that you want some data on existing issues to be in a custom field instead.
- You have an existing custom field of the wrong type. Perhaps you have used a text field, but need it to be a select list instead
- You have some info in the issue title or description that really should be its own field
- You have data in a standard field that you want to move to a custom field, as you will disable the module in VisionProject that uses the field
The general idea: First create the custom field. Then search/filter for issues with same values of the target field, and do a batch update where you set the custom field with that value. Repeat for all possible values. When all data are copied over, you can remove the (old) target field from the issue field configuration used in the project.
Let us take an example: You have earlier defined a custom field on the project, 'Departement', which is a text field (which presumably corresponds to which departement it concerns). But you need this to be a Select list instead.
- First, we create the custom field on the account level:
- Settings tab - Issue configuration - custom fields.
- Click on the 'Add new custom field', and enter values in the dialog.
- For 'Departement_new' (a temporary name), we set type as select list.
- Then, we create the possible values (departments) in the list.
- Now, the field is visible in the list of available custom fields in the account.
- Next, we add the new custom field to the right project:
- Settings tab - Issue configuration - issue fields.
- Here, you will see a list of issue field configurations. Look at which issue field configuration the target project uses, and edit that one.
- Or, perhaps the configuration is used in many projects that you don't want to add the custom fields to - then it is better to copy the configuration, and add the custom fields to that configuration instead, and set it to be used in just the target project(s).
- When editing an issue field configuration you will see a large list of issue fields. Fields not used, are in the bottom section. Make sure to check the 'Use' box, and one Display box (Issues tab..). Click Update.
- If you created a new issue field configuration for the new custom field, you have to go to the Project Settings, and select that to be used in the project instead of the old one. This makes the new custom fields available in the project.
- Now, you should have two issue fields with the same or almost the same names on the project - which you should see in the Issues page.
- One field is the older field, the other is the new custom field, which doesn't have any values as of yet.
- Now to the tedious part.. copying over values from the old fields to the new ones. Go to the Issues page.
- First, you have to find the issues with values in the original field. Make sure that the basic filter (in the tabs) is set to 'All issues'. Select the Filter mode, the funnel icon at the top right. Be certain you can see both sets of issue fields, the original and the new custom field.
- Now, you can filter out issues with particular values of the original fields.
- When seeing all issues with one value, select Batch update (little grey machine icon at top right).
- Select those issues, and choose for the new custom field to be set with the value that matches the original field value.
- When that is done, unfilter on that value of the original field, find other values, and perform a batch update on them too. Rinse and repeat.
- For text fields you have to cut and paste the old value into the textfield in Batch update. (Yes, this gets old quickly..)
- Back to our example: We Filter on the original column 'Department', selects a value, say 'financial' - and then have, say 12 issues. Batch update: we select 'Department_new' (the new custom field - these are at the bottom of the list, below the standard fields.), and selects tha value for 'financial' in the drop down list, and clicks Update. Now those issues are updated. We unfilter (Sets Department_new to ...) and then filters on another value, finds the issues that have those values in the original field, and batch updates the new custom field in those issues. Repeat ad nauseam.
- After a while, you should have two sets of issue fields with identical values (Department vs Department_new).
- At this point, you can remove the original issue field from the issue field configuration, and possibly delete it, if it is really not used. (Note: check carefully that you do not delete something that is actually used somewhere.) You can also rename the new custom field to replace the original field name if you want.