We enabled platform encryption and encrypted two standard fields, field1 and field2 for an object.

We were querying the data from that object and using encrypted field for ordering the data by field1 and field 2 to display results in VF pages and Portals. Not just querying, but used in other reports as well.

Encrypted fields cannot be used in where clauses of query of order by in soql and it throws an error on pages.

How can we allow access to the data in these situations?


1 Answer 1


There isn't a work around. It's critical that you read the Platform Shield Encryption docs before enabling and using it! It can absolutely cripple an implementation and what you might do with it, such as running a query with those fields in a where clause. Understanding those things is the responsibility of the architect who does the implementation.

It's a very secure encryption method for exactly that reasons - you can't use secure data fields to arbitrarily retrieve results. Instead, you need to be able to relate those fields to data that's not encrypted in order to query results from them.

  • 1
    Thank you @crmprogdev. We tried creating formula fields to get values of encrypted fields, but It doesn't allow to copy. The formulas shows them encrypted as well.
    – Anurag
    Commented Apr 11, 2017 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .