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
boihueboihue 

SOQL - Limited transactions

Hi,
I have a trigger having a command for retrieving all records from the Account object that respond to some conditions as follow:
     Account[] accountList = [select name from account where id = :idAnnonceur or id = :idAgence];
 
In some cases, the number of returned records from this object are more than 20 so Salesforce returned an error message as follow:
     UpdateRelation: execution of BeforeUpdate caused by: System.Exception: Too many SOQL queries: 21
 
It seems that Salesforce is limited the Update transactions to Max 20. Is there any way to bypass this limit?
Regards!
David VPDavid VP
It's not the number of records returned that makes you hit the 'governor limits' (look this up in the docs), but the number of queries you do.

My guess would be that your query is sitting in a loop somewhere ?

Do a search on "Too many SOQL queries" in the forums, many messages give you different ways of solving this.


rgds,


David