9

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

2
  • 2
    I've brought this to the attention of the inventor of Custom Metadata Types. He contributes on here from time to time, so he may be able to shed more light on the issue. Sounds like a bug. I can reproduce the behavior on cs14 at the very least. You may want to edit your post to include which instance you tried it on.
    – Adrian Larson
    Commented Jun 28, 2017 at 16:50
  • scheduled for fix in Summer 19 - success.salesforce.com/issues_view?id=a1p3A0000001CvkQAE
    – cropredy
    Commented Apr 5, 2019 at 23:15

1 Answer 1

9

This sounds like a bug. Please file a case for us.

UPDATE: We're working on a fix.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .