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

Which Object should the trigger be on ?

Can Anybody please explain me how to decide the Object that the trigger should be on, i.e Master or the Detail 


What is the logic for that ?





Ok thanks, which means that the trigger could be on either Child or Parent , right??
Bhawani SharmaBhawani Sharma
If you want to update data in Parent object when child is created or updated, then you should have your trigger on Child. Or if you want to update data on Child when parent is updated, keep your trigger on parent.

Inn general life, first scenario is very normal when you update data in parent when child is created/updated

Hi bss881026,


Trigger can be written on almost all objects. However it totally depends on how is your requirement and how your use cases are kicked of. So if there is a use cases that relates to parent object, you need to write a trigger on parent to do the processing you want to do. same is the case for child object. So if there are multiple use cases and relates to both parent and child object which can initiate the required processing, you would be required to write triggers on both objects. In Nutshell, you need to nail down your reuirement into use cases and then think which object you should write trigger on.



Generally speaking, if the child could alter the parent's value, then the trigger should generally be on the child.

Depending on the use case, you might have two triggers, one on the parent, and one on the child. The child would simply update the parent, then the parent would query for all children. This can be useful when you need to know, for example, the total number of records on the parent.