Understanding the outcomes of changing field types is crucial for navigating real-life Salesforce scenarios. It is also essential for effective preparation and study towards various certifications.
In this article, we will explore foundational information, potential data loss risks, and key outcomes associated with changing field types in Salesforce. Keep reading to discover the possible consequences of this process and learn how to avoid common pitfalls.
Admins usually need to change a field type in these situations:
- When business requirements mandate a change in the type of data collected in a field.
- If the stored data doesn’t align with the current data type – typically, this means a setup mistake.
- When reporting challenges that indicate an incorrect field type.
While the information on the Salesforce help page might appear daunting due to the lack of visual elements facilitating a thorough understanding of the subject, this article will guide you through the basics, most common patterns, and the expected outcomes. We will use visual elements to help you better understand this complex topic.
The Basics
Let’s start with the basics. Before getting into the more complex aspects of this topic, we have outlined some basic information that every user should be familiar with when changing field types.
Firstly, only custom fields on custom or standard objects can be changed. There is no option to change standard fields. Some of the wording in exam questions (Salesforce Admin and Platform App Builder) will reference custom and standard to test your knowledge!
In addition to this, it is important to remember that changing the data type of the following field types is not possible:
- Formula fields
- Encrypted fields
- Fields referenced in Setup elements (Visualforce, Flows, Apex, etc.)
- Fields encrypted using Shield Platform Encryption
- Field type in Salesforce Knowledge article types
- The data type of any field that is mapped for lead conversion
- Relationship fields to non-relationship fields and vice versa, only on external objects
- After creating a roll-up summary field on an object, it is not possible to convert the object’s master-detail relationship into a lookup relationship
- A lookup relationship cannot be converted to a master-detail relationship if any records on an object have a null value set for the lookup field
Data Loss: Main Patterns, Risks, and Exceptions
In the chart below, we have grouped the most common patterns associated with potential data loss. Changing any of the field types listed comes with a data loss risk, depending on the direction of the change – whether it is changing ‘to’, ‘from’, or both. In addition, we have outlined key exceptions in a way that is easy to retain.
Key Outcomes to Keep in Mind
Finally, changing field types can have repercussions that extend beyond the field itself.
In the chart below, we have outlined several key outcomes that we consider crucial for users to keep in mind when making changes to field types.
Summary
While Salesforce advises against changing a field’s type if the field contains data, admins know this is not always possible. In most cases, there is a lot of data in the field that needs changing.
Do you have any experience of data loss due to changing field types or know anything else an admin should look out for when facing a similar situation? Let us know in the comments below!