+ Start a Discussion
woodmanzeewoodmanzee 

recursive trigger call

So I have a trigger that takes two fields in a contact (one custom and one standard) and combines them to fill out a custom field in the same contact. The problem is, I can't use it because the trigger has to run before/after update/insert and all that. This gives me a recursive call, because once the contact is saved, the trigger tries to update it, which calls the trigger again, and so on. Any way I can fix that? All ideas would be helpful. Thanks!!

Shashikant SharmaShashikant Sharma

First of all you should put an entry criteria to your trigger so that if your trigger gets executed again your criteria will not be matched. That is the best solution for your problem. You can also use a static variable to control recursive trigger.

 

 

Entry criteria : 

http://forceschool.blogspot.com/2011/05/writing-apex-trigger-issues-and.html

for static

http://forceschool.blogspot.com/2011/05/writing-apex-trigger-issues-and_24.html

http://forceschool.blogspot.com/2011/05/writing-apex-trigger-issues-and_25.html