Loading

Salesforce Picklist Fields Are Not Case-Sensitive and Cannot Store Duplicate Inactive Values

Publiceringsdatum: Jun 11, 2026
Beskrivning

Overview

Salesforce picklist fields are not case-sensitive. This means that picklist values that differ only by letter case — such as "TEST", "Test", and "test" — are treated as identical by the platform. You cannot have multiple active or inactive picklist entries that differ only by case for the same picklist field on the same object.

How Inactive Picklist Values Work

When you insert a record in Salesforce with a value for an unrestricted picklist field that does not already have a matching PicklistEntry defined, the platform automatically creates an "inactive" picklist value for that entry. As documented in the Field Types reference: "When inserting an unrestricted picklist field that does not have a PicklistEntry, the system creates an 'inactive' picklist value. This value can be promoted to an 'active' picklist value by adding the picklist value in the Salesforce user interface." This inactive value can be promoted to an active picklist value through the Salesforce Setup interface.

What Happens When You Insert Case-Variant Values

If you insert one record with a picklist value of "Test", and then attempt to insert another record with "TEST" or "test", the platform compares the values case-insensitively at the object level. Because "TEST" and "test" are considered identical to the already-existing "Test" inactive value, all subsequent insertions take the value of the first entry ("Test"). You cannot create separate picklist entries for "TEST", "Test", and "test" on the same field.
This behavior occurs because picklist values in Salesforce are not unique to individual records — they are tied to the field definition at the object level. Case-insensitive comparison is enforced across the entire object, not just within a single record.

Lösning

Workaround: Use a Text Field Updated by Triggers

If you require record-by-record uniqueness for a field that stores values of different cases, a picklist field is not the right data type for this use case. Instead, create a read-only Text field on the object. Use an Apex trigger to populate this field with the exact case-sensitive value you want to store whenever a record is created or updated. Because text fields do not enforce case-insensitive deduplication at the object level, you can store "TEST", "Test", and "test" in different records without collision.
To manage the valid values that can be stored, use a Custom Setting or Custom Metadata Type as a lookup store for the allowed case-sensitive strings. The trigger reads the allowed values from the Custom Setting and applies the correct value to the text field based on your business logic (for example, by matching a prefix, suffix, or key indicator in the record).
This approach provides record-by-record uniqueness because each record independently holds its own text field value, unlike picklist fields which share a common set of values across all records on the object.

Knowledge-artikelnummer

000386557

 
Laddar
Salesforce Help | Article