May 17, 2011

Encrypted Fields

How to maintain sensitive data in salesforce?
Answer is using Encrypted Fields.

Encrypted Custom Fields are a new field type (released after winter 08) that allows users to store sensitive data in encrypted form and apply a mask when the data is displayed (e.g., Credit Card Number: XXX-XXX-XX-1234)

Now how I can use encrypted fields in my organisation?
You need get Encrypted Field Enabled from Once you get it enabled from salesforce, you will see a new data type option when creating a new custom field.

We can also specify the mask for the field.

Some important points :

  1. User profiles who have the “View Encrypted Data” configuration enabled will be able to view the field normally.
  2. Users who do not have the “View Encrypted Data” profile will see the mask.
  3. User profiles that have the “Modify All Data” permission will not be able to see the value of encrypted data fields.
  4. The field length is restricted to 175 characters in size.
  5. Encrypted Field cannot be type cast as Unique or External ID.
  6. An encrypted field cannot be configured with a default value.
  7. You can’t use encrypted fields in report filters and list views.
  8. You can’t use the encrypted fields in SOQL “where/order” clauses.
  9. Also we can not use encrypted field formula fields, workflow rules, workflow field updates, approval process entry criteria, and approval step criteria.
  10. If you clone a record that has encrypted custom fields, Salesforce will copy the data from the field ONLY if the user has the “view encrypted data” permission.
  11. You can access the data of encrypted field in apex, i.e value is always unmasked.

*Search the Help & Training section, searching for “Encrypted Custom Fields” for more details.



  1. Hi ankit,
    How can i enable the encrypted field feature?

  2. You need log a case to salesforce. You can do this by :
    Clicking on "Help & Training" and then select the "My Case" tab. Click on the "Log a Case" link.

  3. When i query the data of encrypted field, it is same in the encrypted format.

    How can i see the exact value of encrypted field?

  4. I can't see this data type in custom setting fields ? Is is possible the same in Custom setting fields also ?

  5. Hi
    Please help me in clearing off the exam.

    Please send me the links and material that are required to clear this
    developer certification exam is my id ..

    Thanks in Advance

    1. Please help me in clearing off the exam.

      Please send me the links and material that are required to clear this
      developer certification exam is my id ..

  6. Can someone plz tell me is it possible to decrypt the data of Text(encrypted) field type data without using permission set?

  7. We can save our sensitive fields by told your way. From these our fields become secure. Further, You can destroy pest from your house by getting the Residential Pest Control in New York service. Without use any harmful chemical.

  8. Let birthday2__c be my encrypted field

    Is there a way to get this formula to be used in an apex to determine if checkbox is filled:

    If(birthday2__c = " ", true, false)