You need to sign in to do that
Don't have an account?
garyb
Do triggers on an object fire if the object is being deleted because its parents are being deleted?
Hi all,
I have a set up where Object A is a parent of Object B. There is a trigger on delete of an Object B record to delete a record of type Object C related to the Object B record being deleted (ideally, Object C would be a child of B, but we can't do this unfortunately).
So: A is a parent of B, C is related to B but not via a parent/child relationship. And a trigger on B deletes the relevant C object when B is deleted.
If we delete a record of type A, it will delete B (because of the parent/child relationship) and - what I would expect anyway - the trigger on B will delete the relevant C object.
Except that it doesn't. Should it? I opened a clean developer account, put a trigger on B that just prints a debug statement, created the relevant data, deleted A and - nothing in the log.
FWIW, A is the standard Account object, B is the standard Event object, and C is a custom object we've developed.
Thanks in advance for your help!
I have a set up where Object A is a parent of Object B. There is a trigger on delete of an Object B record to delete a record of type Object C related to the Object B record being deleted (ideally, Object C would be a child of B, but we can't do this unfortunately).
So: A is a parent of B, C is related to B but not via a parent/child relationship. And a trigger on B deletes the relevant C object when B is deleted.
If we delete a record of type A, it will delete B (because of the parent/child relationship) and - what I would expect anyway - the trigger on B will delete the relevant C object.
Except that it doesn't. Should it? I opened a clean developer account, put a trigger on B that just prints a debug statement, created the relevant data, deleted A and - nothing in the log.
FWIW, A is the standard Account object, B is the standard Event object, and C is a custom object we've developed.
Thanks in advance for your help!
All Answers
To delete the records in Object C, you need to set a before delete trigger to look for related records...
I do have a trigger on B to delete the related C object but it doesn't seem to be firing. My suspicion is that because B is being deleted because its parent object (A) is being deleted, the trigger is not firing.
Wondering what other people's experiences are?
Thanks to all those who replied!