4

I'm performing this query against a Custom Metadata object:

SELECT Call_Center_Display_Script__c
FROM VDN_Mapping__mdt 
WHERE VDN__c = '99999' OR DNIS__c = '123456786' 
LIMIT 1

But I'm getting this error from Salesforce:

An error has occurred in the following section: [Exception, DisjunctionsNotSupportedException_desc]. Salesforce.com has been notified of this error.

Why does this occur and how can I resolve this?

7

Custom Metadata supports a limited SOQL syntax, and "OR" statements are not supported. From the documentation:

Custom metadata types support the following SOQL query syntax.

SELECT fieldList [...]
FROM objectType
    [USING SCOPE filterScope]
[WHERE conditionExpression]
[ORDER BY field {ASC|DESC} [NULLS {FIRST|LAST}] ]
  • The fieldList can include only non-relationship fields.
  • FROM can include only one object.
  • You can’t use COUNT with custom metadata types.
  • You can use the following operators.
    • IN and NOT IN
    • =, >, >=, <, <=, and !=
    • LIKE, including wild cards
    • AND
  • You can use ORDER BY, ASC, and DESC with multiple fields.

Notice that "OR" is not supported. Apparently that's called a "Disjunction"

  • 1
    ✔ Correct answer – Scott Pelak Jun 14 '17 at 20:25
  • Thanks for posting this one. Can you please go in and accept the answer so it's clear this question is resolved? – Adrian Larson Dec 18 '17 at 18:48
0

There is currently a known issue that is preventing this from working correctly.

SOQL on metadata type records does not work properly when using LIKE in OR relationship

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.