You need to sign in to do that
Don't have an account?
GRStevenBrookes
Too many SOQL queries : 101 -Arghhhhhh!
Hi,
Please could someone help me my telling me why I am gettin the Too Many SOQL Queries Error on the following trigger:
trigger CountAccountType_Customer on Account (after delete, after insert, after undelete, after update) { Set<Id> esIds=new Set<Id>(); for (Account es : trigger.new) { esIds.add(es.OwnerId); } List<User> sis=[select id, of_Accounts_with_Type_Customer__c, (select id from Accounts__r) from User where id in :esIds]; for(User si : sis) { si.of_Accounts_with_Type_Customer__c = si.Accounts__r.size(); } update sis; }
roll up summary on account?
Another trigger?
Review flow in debug logs and see what else is firing right after the line for UPDATE SIS
Starz is right. For clarification, the govenor limit was exceeded at this trigger's execution, but isn't the cause of the problem. Either another function performed a DML that caused this trigger to run when SOQL queries was already at 100, or this trigger was recursively called because of some other trigger that was misbehaving and caused this error. Either way, you need to look for either a DML-inside-loop problem, or a SOQL-inside-loop problem:
Look at the docs for more details on this. Also, try running a free security scan at http://security.force.com/sourcescanner. It will outline errors in your code, such as DML or SOQL inside loops problems.