For this We have taken Two object Teacher(Parent Object) and Employee(Chile Object)
Teacher Structure (PARENT):-
Employee Structure(CHILD) :-
Trigger on Parent Object(Teacher) :-
trigger onParentObjectDelete on Teacher__c (before delete){ list<ID> Teacherlist = new list<ID> (); if(Trigger.isbefore && Trigger.isDelete) { For(Teacher__c T:Trigger.old) { Teacherlist.add(T.ID); } } List<Employee__c> EmpList= [Select ID, Teacher_lookup__c from Employee__c
where Teacher_lookup__c IN :Teacherlist ]; delete EmpList; }
No comments:
Post a Comment