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
sai.sfsai.sf 

Fire parent trigger on update of child

Hi All,

 

     I need to fire a parent object trigger  when i make changes to child object records.Is it possible ?

TopalovichTopalovich

You can definitely update the parent when the DML operation happens on the child, but the before / after insert / update / delete trigger would be written for the child because the parent would not have knowledge of the operation...i.e. nothing is explicitly happening to the parent, so no trigger would fire for it.

 

 

 

Mike

 

 

Jake GmerekJake Gmerek

Mike is correct and if you are writing a new trigger that is how I would do it, however if you have an existing trigger on the parent object that you wanted to fire when the child is updated you could create a hidden custom field on the parent and update it via a field update when the child is updated, which would cause the trigger on the parent to fire.

sai.sfsai.sf

Thanks MIke and Jake for your reply.I am going with workflow field update to fire the existing trigger on parent.but i need to know how to update the field with new value everytime the workflow kicks off.

Jake GmerekJake Gmerek

Use a formula as the condition and set it to 1=1, that is always true and so will update the field everytime that it is checked.