You need to sign in to do that
Don't have an account?
Praetorian65
System.Exception: Too many SOQL queries: 21
I have this error with an after update trigger in salesforce. The trigger definately does not do more than 8 SOQL queries at once and that is the most it can ever do. I am inserting objects via the API and I am doing them in batches. Does a batch of licences count towards this ie 4 queries + 4 queries + 4 queries + 4 queries + 4 queries = 22 queries = error? If so this is a pretty ridiculous limitation.
There are no loops or anything in the trigger.
I have run into something similar. It appears that all triggers for the same object, or that impact the object are all counted together in the single transaction. For me the issue was with Opportunties. I had 5 different opportunity triggers, plus one Opportunity Line Item trigger that all had queries. When I tried to add a 6th trigger on the opporutnity, it would always fail with too many queries, even though, it only had 1 query.
Looking at the full debug log, I could count the queries from each of the triggers getting fired during one update DML, and sure enough, there were more than 20.
Did some refactoring and consolidating of code and got it under the 20 limit.
Maybe that is your issue as well?