After delete Event :- you can delete parent records. Trigger you can write on parent object . If you are not not finding any child records on parent record . You can delete it. But if you write a trigger on child object . How you will get the parent reocrd if the parent record have no child records. So write a trigger on parent. Delete it there only.
Let me Know if it helps you and mark it as best answer if my answer helps you so this so;ution usefull for others
Hi Sree, You need an event to fire the trigger. It doesn't make sense to write the After Delete trigger in Parent object. On delete of a Parent record, why do we need to check if Child object has related data?
An After Delete trigger in child object on the other hand, can fetch the Parent Record id from Trigger.Old object and remove Parent if the deleted child is the last of its kind.
Thanks !
This trigger will have to check if the Master Record has anymore children attached to it. If not, delete it.
After delete Event :- you can delete parent records.
Trigger you can write on parent object . If you are not not finding any child records on parent record . You can delete it.
But if you write a trigger on child object . How you will get the parent reocrd if the parent record have no child records.
So write a trigger on parent. Delete it there only.
Let me Know if it helps you and mark it as best answer if my answer helps you so this so;ution usefull for others
You need an event to fire the trigger. It doesn't make sense to write the After Delete trigger in Parent object.
On delete of a Parent record, why do we need to check if Child object has related data?
An After Delete trigger in child object on the other hand, can fetch the Parent Record id from Trigger.Old object and remove Parent if the deleted child is the last of its kind.