Contact ‘name’ can not be filtered in a query call

apexdynamic-soqlsoql

I tried to run this query and got the error as 'name' can not be filtered in a query call. The query is [select id,name from contact where name like '%test%'] . The result is varying from org to org. I tried in my developer edition and it is working fine. when I try this is in my project sandbox and I got the mentioned error.

Best Answer

As mentioned in my comment the encryption fields cannot be used in the filter criteria . You cannot use those field in Aggregate functions such as MAX(), MIN(), and COUNT_DISTINCT(),WHERE clause,GROUP BY clause,ORDER BY clause as well.

You may have to remove the encryption to use them in the above scenarios. Please find the below article from Salesforce which explains the same .

Related Topic