I tried querying a Encrypted field in SOQL. Gives an error: encrypted field 'Email' cannot be filtered in a query call

Can i achieve it using SOSL??


Yes, see the Key limitations and their workarounds documentation.

You can use SOSL with an IN EMAIL FIELDS to get down to a small set of results and then an Apex look to refine to just the Email field (if you have multiple email fields and only want to match one of them).

Note that unit tests become more awkward because SOSL's index isn't built so you have to nominate the Id(s) that will be returned using Test.setFixedSearchResults().

  • I have only one email field. – Samuel Jackson Oct 19 '16 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.