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
happy devhappy dev 

code is good in sandbox but has error when deployed to production

I have code to draw around 200 districts from a custom object.  It works fine in sandbox but failed when it is deployed to production.  Anyone knows why?  The error is "Too many SOQL queries: 101", Failure Stack Trace: "

 

 

    Map<Id, District__c> DistrictById = new Map<Id, District__c>([SELECT Id, Name FROM District__c]);

 

 

Thanks

bob_buzzardbob_buzzard

This sounds like your query is coming after 100 other queries.  Is this inside a loop or a trigger or similar?  You'll need to track down what is happening prior to this query being executed.