You need to sign in to do that
Don't have an account?

Custom Metadata Type - hitting SOQL limit?
It was my understanding after reading a few different posts and articles like this one that custom metadata types could have unlimited SOQL queries in a single Apex transaction. To give you an idea of the code that I'm using, it's designed to find a set of values (stored in custom metadata) to apply to an opportunity based off of some criteria pulled from the opp. When I tried to run this to update opps in bulk, it failed on the SOQL query error. My query:
Am I misunderstanding what is meant by "unlimited" queries?
List<Channel_Discount__mdt> chanSetting = [SELECT Direct__c,Fulfillment__c,Authorized__c,Certified__c,Regions__c,Excluded_Countries__c FROM Channel_Discount__mdt WHERE Discount__c = :w AND Distributor_Type__c = :distType AND Business_Type__c = :bisType];
Am I misunderstanding what is meant by "unlimited" queries?
Custom Metadata and Custom Setting are different features of the Salesforce Platform.
Jessica - You're right! It shouldn't count against the limit but there is an exception. When you query a long text area field from a metadata it does counts against the limits, please, check if that is your case. If not, check whether or not, another SOQL is affecting your limits if there is any.
https://help.salesforce.com/articleView?id=custommetadatatypes_limits.htm&type=5 (http://https://help.salesforce.com/articleView?id=custommetadatatypes_limits.htm&type=5)
Prashant - You're also right in saying that is better to retrieve Custom Settings using its classes but Jessica mentioned a Custom Metadata and not a Custom Setting. Custom metadata is retrieved by using SOQL queries.
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
Custom Metadata and Custom Setting are different features of the Salesforce Platform.
Jessica - You're right! It shouldn't count against the limit but there is an exception. When you query a long text area field from a metadata it does counts against the limits, please, check if that is your case. If not, check whether or not, another SOQL is affecting your limits if there is any.
https://help.salesforce.com/articleView?id=custommetadatatypes_limits.htm&type=5 (http://https://help.salesforce.com/articleView?id=custommetadatatypes_limits.htm&type=5)
Prashant - You're also right in saying that is better to retrieve Custom Settings using its classes but Jessica mentioned a Custom Metadata and not a Custom Setting. Custom metadata is retrieved by using SOQL queries.
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.