Things to Consider Before Changing Field Data Type in Salesforce
So, you want to change your field’s data type? Hold thy horses, know that there are some restrictions and considerations which should be taken care of before doing so.
Don’t forget to check out: How To Plan For A Successful Salesforce Data Migration?
Firstly we should be giving a thought to a very important problem which none of us want to encounter, ‘DATA LOSS’, this is one situation which nobody wants to face in any walk of life.
Data loss is the arch-nemesis of any person working in any technical field, the thought is so scary it might even haunt you in your sleep, so to sleep well consider data loss and give its prevention utmost priority before changing your field’s data type.
Situations of Data loss on field data type conversion:-
- Conversion to or from date or date/time
- Conversion to number from any other type
- Conversion to percent from any other type
- Conversion to Currency from any other type
- Conversion from Checkbox to any other type
- Changing from Picklist (Multi-Select) to any other type
- Changing to Picklist (Multi-Select) from any other type
- Changing from Auto Number to any other type
- Changing to Auto Number from any type except Text
- Changing from Text to Picklist
Some Considerations before changing the field’s data type:-
- Convert only those custom fields which have no existent data, because when we do so we risk losing our data.
- In case of data loss, any pre-existent list view based on the converted field is deleted, and also assignments and escalation rules will also have tampered.
- We don’t have the option of changing the data type of a custom field for all the data types One such restriction arises in case of conversion of existing fields to encrypted types and vice versa.
- In Salesforce Knowledge article types, field type conversion is not supported
- You cannot change the data type of a custom field that has been referenced by other items like Apex code, VF pages, workflows.
- Your conversion even if valid might not take place at once, because the conversion of a particular record might require conversion of many related records at once, so for a smooth process our conversion request will be queued and you will be notified via email on completion of this process.
- Before changing the field data type, make sure that it is not being operated on be any workflow or formula and validation.
- If a custom field that is set as an external ID, we can only covert it to text number or email, for any other type conversion the custom field will not act as an external ID any longer
- If any custom field is mapped for lead conversion we can’t change its data type.
- If a custom field is encrypted we cannot change its the data type.
In addition to these considerations, we also have some restrictions related to some specific data types:-
Formula- They are special fields which are read-only they cannot be converted to any other field and vice versa
Picklist- You can change custom picklist to custom checkboxes. You can change custom picklist to multi-select picklist without losing any data.
Auto Number- You can convert an auto number field int the text field and vice versa without risking any data loss, any other data type conversion is not accepted. There is one more catch that auto-number fields can contain a maximum of 30 characters so before conversion from text to auto number consider any records which have more than 30 characters in that field.
Relationships- Conversion of relationship fields to non-relationship fields and vice versa is possible but only on external objects.
-If your org has a large database with a large number of records when you convert a master-detail into a lookup and vice versa a waiting page will be displayed on requesting such change.
Text area-Whenever we convert a long text area field to these data types:-
- Text Area
The data in the records will automatically be truncated to the first 255 characters of that field