Loading
Set Up and Maintain Your Salesforce Organization
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Use Encrypted Data in Formulas

          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.
          Note
          Note This content relates to Shield Platform Encryption. Read about implementing field-level encryption using Shield Extension in Own from Salesforce.
          Note
          Note Formula fields that reference encrypted data are supported only in Salesforce Classic. They aren't supported in Lightning Experience or via SOQL. If you work exclusively in Lightning Experience or have dependencies on formula fields that require Lightning Experience, we recommend that you don't reference encrypted fields in formulas. The following examples apply to Salesforce Classic.

          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:
          (encryptedField__c & encryptedField__c)
          Why it works:

          This formula works because & is supported.

          This doesn’t work:
          LOWER(encryptedField__c & encryptedField__c)
          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:
          CASE(custom_field__c, "1", cf2__c, cf3__c))

          where either or both cf2__c and cf3__c are encrypted

          Why it works:

          custom_field__c is compared to “1”. If it’s true, the formula returns cf2__c because it’s not comparing two encrypted values.

          This doesn’t work:
          CASE("1", cf1__c, cf2__c, cf3__c)

          where cf1__c is encrypted

          Why it doesn’t work: You can’t compare encrypted values.

          ISBLANK and ISNULL

          This works:
          OR(ISBLANK(encryptedField__c), ISNULL(encryptedField__c))
          Why it works:

          Both ISBLANK and ISNULL are supported. OR works in this example because ISBLANK and ISNULL return a Boolean value, not an encrypted value.

          Spanning

          This works:
          (LookupObject1__r.City & LookupObject1__r.Street) &
           (LookupObject2__r.City & LookupObject2__r.Street) &
            (LookupObject3__r.City & LookupObject3__r.Street) &
             (LookupObject4__r.City & LookupObject4__r.Street)
          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.

           
          Loading
          Salesforce Help | Article