Assume, I've got a standard picklist field Rating
on Account
with values Hot
, Cold
. Using enabled Translation Workbench
I've translated these values into German.
When the language of a user is set to English
, and the user performs a SOQL query
SELECT Id, Rating FROM Account WHERE Rating LIKE 'Cold'
it returns N
records. But if we change the language of the user to German
, the same SOQL query returns 0
records. However, when it changes to
SELECT Id, Rating FROM Account WHERE Rating LIKE 'Kalt'
it returns N
records as well as for the very first scenario. At the same time, the returned values of the Rating
field remain untranslated ('Cold'). This means that the LIKE
operator implicitly translates the values of picklists before comparison. I've tested IN
, NOT IN
, =
SOQL Comparison Operators and they don't behave like LIKE
, they perform a comparison based on picklist value API Name
not Label
. There is no such information about it in Salesforce Docs.
So finally my question is:
Why does the
LIKE
SOQL operator implicitly translate picklist values before comparison and how to perform a comparison based on picklist value API Names using theLIKE
operator?