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
Jim McCabeJim McCabe 

BulkAPI Error

We are DBAmp to upload information to all of our leads and am getting this error.  Would someone be willing to explain where I am going wrong.  We are on Enterprise Edition

BulkAPI:Update:75060000000wiETAAY:751600000029qGJAAY:1677:Error - CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:leadBeforeInsertUpdate: System.LimitException: Too many SOQL queries: 101:--
Anil SavaliyaAnil Savaliya
Hi Jim,

You are running more than 100 SOQL in trascation,Please check debug log.
PrasanntaPrasannta (Salesforce Developers) 
Hi,

This error System.LimitException: Too many SOQL queries: 101is due to the fact, you are hitting on governor limit. The governor limit that says we can run total 100 SOQL queries in a context and you are hitting the limit.

All the triggers fired will be counted in a single context or call. We need to ensure that total number of SOQL fired should be less than 100.
In order to by pass this, you need to change your code in such a way that SOQL fired must be less than 100 or if you need to change the context then you can use @future annotation which will run the code asynchronously.

You need to make sure that the SOQL query you are using should not be inside the for loop.

There are certain best practices which you would have to follow to avoid this error (to avoid hitting governor limit).

1. http://wiki.developerforce.com/page/Best_Practice:_Avoid_SOQL_Queries_Inside_FOR_Loops

2. http://salesforcedeveloperblog.blogspot.com/2011/05/best-practices-of-triggers.html

3. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_bestpract.htm

4. http://wiki.developerforce.com/page/Apex_Code_Best_Practices

If you follow the above practices, the error will stop. Moreover there is no way wherein we in Salesforce can increase the
governor limit or can stop it so best practices need to be followed.

Hope this information helps.
nbknbk
Hello,

Do you required to run the triggers while executing the DbAMP tool, if not please turn off the trigger and make it as active after done the activity.
if it is managed package you need maintian one flag field and based on the flag the trigger will execute.
if(flagfield==true)
{
   //execute the trigger code
}

this is one way to by bass the trigger for bulk data operations