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
ipsips 

Trigger on junction object not get fired

Hi,

I have one junction object 'C' with 'A' and 'B' as parents.

I have written a trigger on 'C' junction object for after delete event. When I delete a junction object,it gets called properly.

But, when I delete a parent object 'B', it deletes a junction object with it, but not fired the trigger written on junction object.

 

Can any one tell me why this is happening?

 

Thanks in advance....

Best Answer chosen by Admin (Salesforce Developers) 
Ispita_NavatarIspita_Navatar

Hi,

Your juction object has master-detail relationship with object --> A and B . Also you have mentioned you have written a trigger on the object C - your junction object.

In salesforce when a parent is deleted in a master-detail relationship the children are silently deleted and  donot fire the triggers written on them, this is as per salesforce design, hence the fact that your trigger not getting fired is normal.

 

This happens as this how salesforce has designed the master-detail relationship to work.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

All Answers

Ispita_NavatarIspita_Navatar

Hi,

Your juction object has master-detail relationship with object --> A and B . Also you have mentioned you have written a trigger on the object C - your junction object.

In salesforce when a parent is deleted in a master-detail relationship the children are silently deleted and  donot fire the triggers written on them, this is as per salesforce design, hence the fact that your trigger not getting fired is normal.

 

This happens as this how salesforce has designed the master-detail relationship to work.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

This was selected as the best answer
ipsips

Hi,

Thanks for reply.

Is there any workaround available for this trigger to fire?