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
KD9500KD9500 

Triggers, too many soql queries

Hi,

 

I have created a trigger on a object. Based on a value in a field it would create required records in the second object. I am facing an error if the iteration goes beyond 8. I get a message saying there are too many soql queries.

Is there something that i am overlooking.

 

Thanks

Krishnadas M R

Best Answer chosen by Admin (Salesforce Developers) 
SteveBowerSteveBower

You probably have your select statements inside a loop somehow, or perhaps are recursing, etc.

 

Does the second object have triggers as well?  If so, are those bulk-safe?

 

Post the code.  -Steve.

All Answers

SteveBowerSteveBower

You probably have your select statements inside a loop somehow, or perhaps are recursing, etc.

 

Does the second object have triggers as well?  If so, are those bulk-safe?

 

Post the code.  -Steve.

This was selected as the best answer
KD9500KD9500

Hi Steve,

 

Thanks for the pointers, yes we had the select statements inside a loop and there were many. We were able to take the unwanted loops out and join the select statements appropriately, now it works properly.

 

Thanks

Krishnadas M R