function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bretondevbretondev 

SOQL Query filtering on Encrypted Fields not working

Hello  community,
I have a SOQL Query on Encrypted Fields.
I have a Contact named John Doe.
When I do "SELECT FirstName,LastName FROM Contact WHERE FirstName='John', I get 0 results.
FirstName and LastName are encrypted with "deterministic encryption, case-insensitive".
According to this help page : 
https://developer.salesforce.com/docs/atlas.en-us.securityImplGuide.meta/securityImplGuide/security_pe_deterministic_overview.htm
"For example, you might run a SOQL query in custom Apex code against the Contact object, where LastName = 'Smith'. If the LastName field is encrypted with probabilistic encryption, you can’t run the query. Deterministic encryption addresses this problem."
 
My understanding is that filterring is supposed to be supported for fields encrypted with  "deterministic encryption, case-insensitive". 
 
What am I missing?
How to make my SQOL query work?
 
Many thanks
Best Answer chosen by bretondev
bretondevbretondev
I could fix the issue thanks to this blog:
https://salesforce.stackexchange.com/questions/335452/new-spring-21-sandbox-soql-query-fails-on-encrypted-account-name

I went to Setup | Platform Encryption | Key Management and generated a new tenant secret.
Then I went to Setup | Platform Encryption | Encryption STatistics and re-synced my data.