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:
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_where.htm
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?
EDIT
Salesforce has logged this as a known issue and it is under review: https://success.salesforce.com/issues_view?id=a1p3A0000001CvkQAE
Best Answer
This sounds like a bug. Please file a case for us.
UPDATE: We're working on a fix.