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
sparktestsparktest 

after update trigger on master object fired when update made on record in child object related list

 
I have two custom objects, one is the master and one child.  When I click on Edit on a record of the child object in the related list of the master object, make a change and click save, an after update trigger for the master object fires.  Is this a bug?  I am not updating anything on the master object but it is acting like I am......
 
Any thoughts on this?
 
Thanks,
JeremyKraybillJeremyKraybill
Yes, triggers on masters fire when detail records are changed. It is not well-documented in the developer's guide, but it is the behavior. I agree that at best it's counter-intuitive, at worst it is a bug -- it seems more logical to me that if you need children to fire trigger logic, you create a trigger on them.

There are a bunch of workarounds you can implement to prevent your master-level trigger from firing when the detail records are edited. Just add some boolean checks at the top of your trigger that determine whether your master-level record's relevant fields have changed. Looking at last modified date should work, for example.

HTH

Jeremy Kraybill
Austin, TX
sparktestsparktest

Thanks for the info.  I wrote a work-around that seems to have taken care of it.  I can imagine cases though where this might actually come in handy....