You need to sign in to do that
Don't have an account?
Hanumanthu
Too many SOQL Queries 101 on triggers
Hi All,
In My org Opportunity Object Contains 20 Triggers. Each trigger contains 5 Queeries. Now I am trying to inserting the record.It shows the ERROR* like this " Too many SOQL Queries 101". The triggers all are fired and it reach the governer limit .So please help me how to resolve this situation.
Thanks&Regards
Hanu
In My org Opportunity Object Contains 20 Triggers. Each trigger contains 5 Queeries. Now I am trying to inserting the record.It shows the ERROR* like this " Too many SOQL Queries 101". The triggers all are fired and it reach the governer limit .So please help me how to resolve this situation.
Thanks&Regards
Hanu
Seperate all insert n update logic.
On update add condition to check if the specific value as changed
for Expl: if you have any update logic which needs to be executed for specific value change
add condition like this
if(trigger.new[0].SomeField__c != trigger.oldMap.get(trigger.new[0].id).SomeField__c){ //this checks if the value is changed for update
code to be executed.......
}
Check out this link for stopping recursive trigger. you need to debug more n stop unnecessary execution. Unless looking at your code can't suggest the exact things to change.
Stopping recursive trigger (http://help.salesforce.com/apex/HTViewSolution?id=000133752&language=en_US)
All Answers
1. Stop unnecessary firing of triggers, add conditions and execute those part of code only if the specific criteria is met.
2. Check old and new values and execute only on change.
3. if there is any recursive firing use recursion helper class to set values after execution.
Thanks for replying. But when we are trying to Insert a new record the triggers which are existing on the object are firing multiple times due to which we are not able to save the record.
Pls suggest!!!!!!!!!!!!!!!!!!
Seperate all insert n update logic.
On update add condition to check if the specific value as changed
for Expl: if you have any update logic which needs to be executed for specific value change
add condition like this
if(trigger.new[0].SomeField__c != trigger.oldMap.get(trigger.new[0].id).SomeField__c){ //this checks if the value is changed for update
code to be executed.......
}
Check out this link for stopping recursive trigger. you need to debug more n stop unnecessary execution. Unless looking at your code can't suggest the exact things to change.
Stopping recursive trigger (http://help.salesforce.com/apex/HTViewSolution?id=000133752&language=en_US)