I am currently trying to update a set of data, but I am receiving the error "Too Many SOQL Queries: 101". From what I have seen while searching around, this is normally an error that occurs while querying inside a loop, but that is not the case for what I wrote. Any ideas for why I'm getting the error?

List<object1__c> objectList = [SELECT Id, checkboxField__c FROM Interest__c WHERE Id in (SELECT Object1_Id__c FROM object2__c)];

for (object1__c a: objectList)
    a.checkboxField__c = true;
update objectList;

object2__c is a custom object that has a custom field on it called Object1_Id__c which is a lookup to to object1__c.

  • 2
    are there other triggers on the same event as this trigger?
    – Rao
    May 15, 2014 at 17:24
  • 1
    That must be it! There is a trigger with SOQL inside of it that goes off everytime object1 is updated. Thanks, I didn't even think of that.
    – Katie Swol
    May 15, 2014 at 17:30

1 Answer 1


Check if there are other triggers on the same event as this trigger, could be causing the SOQL error.

  • Thanks for your help! I'm going to just use a dataloader to get around this.
    – Katie Swol
    May 15, 2014 at 17:35
  • @Katie You shouldn't try to use utilities to work around bad code...
    – dphil
    May 15, 2014 at 17:45
  • I agree, but since this is actually just something I was running in the execute anonymous window since it is a one time thing- I'm not sure how else to get around it since I don't want to mess with existing triggers.
    – Katie Swol
    May 15, 2014 at 18:05

Not the answer you're looking for? Browse other questions tagged .