Use Encrypted Data in Formulas
Use custom formula fields to quickly find encrypted data. Shield Platform Encryption is compatible with several operators and functions, and can render encrypted data in text, date, and date/time formats, and reference quick actions.
Required Editions
| Available in both Salesforce Classic (not available in all orgs) and Lightning Experience. |
| Available in: Enterprise, Performance, and Unlimited Editions with the Salesforce Shield or Shield Platform Encryption licenses. |
| Available for free in Developer Edition. |
Supported Operators, Functions, and Actions
Supported operators and functions:
&and+(concatenate)-
BLANKVALUE -
CASE -
HYPERLINK -
IF -
IMAGE -
ISBLANK -
ISNULL -
NULLVALUE
Also supported:
- Spanning
- Quick actions
Formulas can return data only in text, date, or date/time formats.
& and + (Concatenate)
| This works: | |
| Why it works: | This formula works because |
| This doesn’t work: | |
| Why it doesn’t work: | LOWER isn’t a supported
function, and the input is an encrypted value. |
Case
CASE returns encrypted field values, but doesn’t
compare them.
| This works: |
where either or both |
| Why it works: |
|
| This doesn’t work: |
where |
| Why it doesn’t work: | You can’t compare encrypted values. |
ISBLANK and ISNULL
| This works: | |
| Why it works: | Both |
Spanning
| This works: | |
| How and why you use it: | Spanning retrieves encrypted data from multiple entities. For example, let’s say you work in the customer service department for Universal Containers. A customer has filed a case about a distribution problem, and you want to see the scope of the issue. You want all the shipping addresses related to this particular case. This example returns all the customers’ shipping addresses as a single string in your case layout. |
Validation
The encryption validation service checks your org to make sure that it’s compatible with encrypted formula field types.
When you encrypt a given field, the validation service:
- Retrieves all formula fields that reference the field
- Verifies that the formula fields are compatible with encryption
- Verifies that the formula fields aren’t used elsewhere for filtering or sorting
Limits
Up to 200 formula fields can reference a given encrypted custom field. A field that is referenced by more than 200 formula fields can’t be encrypted. If you must reference an encrypted custom field from more than 200 formula fields, contact Salesforce.
When you specify multiple fields to encrypt at one time, the 200-field limit is applied to the whole batch. If you know that you’re encrypting fields that have multiple formula fields pointing to them, encrypt those fields one at a time.

