When using SOQL to query custom metadata records, the comparison in my where clause appears to be case-sensitive. Example:
MyField__c is a text field that is NOT unique and NOT case sensitive
select MyField__c from MyCustomMetadataType__mdt where MyField__c = 'testvalue'
Results: 0 records
The record is stored as ‘TestValue’ and the following query finds it:
select MyField__c from MyCustomMetadataType__mdt where MyField__c = 'TestValue'
Results 1 record
This is contrary to SOQL documentation:
Expression is true if the value in the specified fieldName equals the
specified value in the expression. String comparisons using the equals
operator are case-sensitive for unique case-sensitive fields and
case-insensitive for all other fields.
Am I missing something or are queries against custom metadata working differently?
Salesforce has logged this as a known issue and it is under review: https://success.salesforce.com/issues_view?id=a1p3A0000001CvkQAE
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
This sounds like a bug. Please file a case for us.
UPDATE: We’re working on a fix.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0