How to Change Field Type in Salesforce?

Recently, while creating a feedback form for one of my clients, I was required to change the field type of some records. In Salesforce, we can easily change the field type by navigating the object manager. I will show you how to change field type in Salesforce.

In Salesforce, the change field type is the feature that allows users to modify or change the data type of custom fields in Salesforce Org.

In this tutorial, we will discuss the following 3 different examples:

  • Example 1: Convert Number to Text field in Salesforce.
  • Example 2: Convert Checkbox to Picklist Field in Salesforce.
  • Example 3: Reset or Restart the Auto Number field using the change field type.

Example 1: Convert Number to Text field in Salesforce

For example, in the custom object named Bank_Account_c. There is an Account No. custom field, which is a number data type. The number data type field does not contain alphabetic values.

Now, the requirement is that the clients want to store alphanumeric values in that field. But when we try to save the record with an alphanumeric value, we got an error.

How to Change Field Type in Salesforce

The following steps will show how to change the field type number to a text field in Salesforce.

1. Click on Setup. -> Object Manager. -> In the search box, enter the object name. -> Click on it.

Convert Number to Text field in Salesforce

2. Then click on Fields & Relationships. In that, search for the field in which you want to change the field type, then click on that field.

Change Number to Text field in Salesforce

3. Click on the Edit button.

Use Change Field Type to Convert Number to Text field in Salesforce

4. Here, you will see the Change Field Type button. This button is only available on custom fields. Click on it.

Use Change Field Type to Change Number to Text field in Salesforce

5. Select the new data type you want to replace with the old one. Here, I have selected the Text data type to replace it with the Number data type.

Change Field Type in Salesforce Lightning

6. Then, you can change the Label and set the Length of the text field. You can also make the text field Required and Unique. Then click on the Save button.

Convert Number to Text field Using Change Field Type in Salesforce

7. Now, try to create a record by entering an alphanumeric value in the Account No. field. This time, it will not give any error.

Change Number to Text field Using Change Field Type in Salesforce

This is how we can change the field type of the number to a text field in Salesforce.

While converting the master-detail relationship to the lookup relationship, the Change Field Type button will not be visible to you.

To know more, read the Convert Master-Details Relationship into Lookup in Salesforce.

Example 2: Convert Checkbox to Picklist Field in Salesforce

For example, there is a custom checkbox field named Project Status_c on the custom Project_c Object.

When the checkbox is checked, the project is completed. However, the clients want to add more stages(Planning, Development, Testing, and completion) to the project status. Creating multiple checkboxes will make the form very lengthy.

So, instead of that, we can convert the checkbox field to the picklist field, and also we can add stages to the picklist.

In the following steps, we will see how to change the field type checkbox to the picklist field in Salesforce.

1. Click on Setup. -> Object Manager. -> In the search box, enter the object name. -> Click on it.

Then click on Fields & Relationships. Click on the field that you want to change the field type.

Change the checkbox to picklist field type in Salesforce Lightning

2. Here, we want to edit this Project Status field, so we click on the Edit button.

Change Checkbox to Picklist using Change Field Type in Salesforce

3. Click on the Change Field Type button.

Use Change Field Type in Salesforce

4. A pop-up message appears. Changing to the selected data type will cause you to lose all existing data in this field. If the old data is important, then back up your data before changing or modifying the data type.

Then, select the Picklist field and click on the Next button.

Convert field type using Change Field Type option

5. Here, you can change the Label. Then, enter the values: Planning, Development, Testing, and Completion, and click on the Save button.

Convert Checkbox to Picklist in Salesforce

6. Then, as you navigate to the project object to create the record, you will see the picklist field with entered values.

Salesforce change checkbox to picklist field type

This is how we can change the field type of the checkbox to the picklist field in Salesforce.

You can also read articles on Salesforce’s official website on change field types.

Example 3: Reset Auto Number Field using Change Field Type

For example, you created a Unique ID field with Auto Number as Data Type, and you also created some records using that field. But now the client wanted to reset that Unique ID field. So that it will start again from 0 or the defined started number.

In the following steps, I explained how to reset the auto number field using the change field type.

1. Click on Setup. -> Object Manager. -> Navigate to the object in which you want to reset the auto number field.

Click on the Fields & Relationships. -> Then click on the Unique ID(auto number) field to reset and click the Edit button.

Then click on the Change Field Type button.

Reset or restart the auto number field in Salesforce Lightning

2. Now, select the Text data type and click on the Next button. After that, Save the field.

Auto Number Field Reset in Salesforce

3. Here, you can see the Unique ID(auto number) field has been converted to the Text field.

How to Reset Auto Number Field in Salesforce

4. Again, repeat the steps for changing the field type. Click on the auto number that we converted into text. Then click on the Edit and Change Field Type button.

Reset Auto Number Field in Salesforce

5. Select the Auto Number data type and click on the Next button.

Reset Salesforce Auto Number Field

6. Now you can see there is a field named Starting Number. In that field, you can enter the number from which you want to start this auto number field. Then click on the Save button.

how to reset auto number field in salesforce

7. Now, you will see the field has again converted into an auto number.

salesforce auto number field

This is how we can reset that auto number field in Salesforce using the change field type button.

Considerations While Changing Field Type in Salesforce

While converting the field data type, we need to remember some points to maintain data integrity and functionality:

  1. When we change the field data type, data might be lost in some situations because the new data type is incompatible with the older one. For example, when you try to convert the Text field to a Number data type, you can lose the data.
  2. The default values you set for the previous data type should be updated according to the new data type.
  3. We cannot change or convert the standard field data type, so there is a feature to change the field type for the standard fields.
  4. We can only change or modify custom field data types.
  5. When changing the data type, ensure that the new field type is compatible with the older one. Otherwise, backing up your data before changing or modifying the data type is very important.

You can also read the article on change field type in Salesforce.

Conclusion

I hope you have an idea about changing field type in Salesforce, when we can change data types, and the considerations that we should remember while converting data type or field type in Salesforce. As we have seen, we can also reset the auto number using the change field type option.

Then we saw some examples, and I explained steps to how to change the field type in Salesforce.

You may like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.