1

Unable to use Dataloader to import on account due to this error below

AccountSetToLiveTrigger: System.LimitException: Too many SOQL queries: 101

My Trigger code is below

 trigger AccountSetToLiveTrigger on Account (after update) {
  Account[] accounts = Trigger.new;
  for (Account account : accounts) {
    new AccountSetToLive(account).handleUpdatedAccount();
  }
} 

Can anyone help?

1
  • It seems like that you have a SOQL in loop. it would be great if you can post your handler class code as well.
    – Himanshu
    Oct 27 '15 at 17:31
1

When this is the only account trigger in your org, I suggest to look at the class AccountSetToLive and it's method handleUpdatedAccount(). There is probably a select statement in there. This is called for every account that is inserted by the data loader. You should re-write the code so that there is no select within a loop (like the for loop in your trigger).

As a workaround, you can also try to reduce the batch size in the data loader settings. If the batch size is 50 and two select statements are called per account in your code, it would just stay within the limit of 100.

1
  • In addition to this answer, one other workaround is to deactivate the trigger while importing records. When import is complete activate it again. BUT this is not the best practice.
    – abdn
    Oct 27 '15 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.