function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kt YadavKt Yadav 

Like Clause in SOQL for Custom Meta Data

I am running below query on my custom meta data with like clause but it is not giving the correct results.
string prodCode='%TW%';
for(RCF_Application_File_Status__mdt objFileStatus : [Select MasterLabel,DeveloperName,Final_Status__c,RCF_Product_Code__c From                                     RCF_Application_File_Status__mdt where RCF_Product_Code__c like :prodCode OR RCF_Product_Code__c = 'ALL']){
    system.debug(objFileStatus.MasterLabel+'_____'+ objFileStatus.Final_Status__c+'---------------------'+objFileStatus.RCF_Product_Code__c);

Using the above query i am only rows containing "All" not the result containing "TW,ML".
Is there any limitations on Custom Meta Data for "Like" Clause.
Khan AnasKhan Anas (Salesforce Developers) 

I trust you are doing very well.

SOQL Queries on Custom Metadata is case sensitive. Salesforce has logged this as a known issue and it is under review and they are working on a fix. You can refer to below link to check.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.

Thanks and Regards,
Khan Anas
Kt YadavKt Yadav
Hi Khan,

We have data presnet in the database and it is exactly matching so no case sentivity issue here, we are not able to fecthc this record using "Like" clause.