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
dawnzdydawnzdy 

How to work around SOQL queries limitation when bulk updating?

Hi,

 

    We have a trigger activated after update of account manager on account. In the trigger, it queries the old manager and put it to remove list. So when we do a bulk update of AM using Apex data uploader, error will occur when the update records is more than 20. Then we can only do it 20 at a time.

    I know there is a limitation of 20 SOQL queries trigger. But we do need to do the bulk update now and than. Do you have any solution to this?

 

    Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
tmatthiesentmatthiesen

You need to make sure your SOQL and DML logic is outside any trigger interation logic.  Take a look at the following doc:

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_patterns_bulk.htm

All Answers

tmatthiesentmatthiesen

You need to make sure your SOQL and DML logic is outside any trigger interation logic.  Take a look at the following doc:

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_patterns_bulk.htm

This was selected as the best answer
dawnzdydawnzdy
Thanks so much!