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
rushrush 

inserting child triger update on parent?

 

I am performing a before update trigger on a record that creates records on a child object.  It has been working fine.  Now I am simply adding one field to the insert on the child, and when trying to update the code I am getting a 'recursive trigger' error.  I know basically what this means, but didn't think inserting child records pushed an update trigger on a parent record. 

 

So, in other words, the update on the parent record triggers an insert of child records which then tries to trigger an update event on the parent record all over again.  Is there a way to prevent this from occuring?

 

It is strange I didn't have a problem with this just a couple weeks ago when I initially deployed this trigger code.

Ritesh AswaneyRitesh Aswaney

Potentially  some config or code might have been created since the last time which may explain the recursion.

 

The uniqueness of static variables across the execution context is used to avoid recursion

http://www.salesforce.com/docs/developer/cookbook/Content/apex_controlling_recursive_triggers.htm