π§© Here is a puzzle that I don't know whether it has a solution or is it a Salesforce glitched org. π€
The SOQL query below is supposed to list all records whose picklist Relationship_Type__c contains __SA (that is, 2 underscores followed by the letters SA):
ππΎππ» πππ΄ππ
SELECT Id, Name, Relationship_Type__c
FROM Account_Relationship__c
WHERE Relationship_Type__c LIKE '%\_\_SA%'
ππΌ This query runs fine on a developer org and correctly returns the records containing __SA.
ππΌ However, in a different org, the same query doesn't return the records containing __SA.
Already tried (the picklist labels and values are the same):
WHERE toLabel( Relationship_Type__c ) LIKE '%\_\_SA%'
No difference! π³
Tried this one too:
WHERE Relationship_Type__c LIKE '%SA'
It didn't bring anything! π€―
Does anyone know what could cause this issue? β
Like and/or comment so that when I finally figure out (or someone else does), you will have a notification. π π¬ ππΌ
UPDATE: We've tried so far:
- checked the picklist metadata
- looked for special characters
- compared with different orgs
- tried with different API versions
The only thing that appeared to make a difference was to add a new picklist option WITHOUT the underscores, with a space instead. That made the query LIKE '% SA' return something. However, updating the existing values didn't work. Very weird!