Back to LinkedIn posts

LinkedIn post 287

🧩 Here is a puzzle that I don't know whether it has a solution or is it a Salesfor...

🧩 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!