You need to sign in to do that
Don't have an account?
![venkatsforce venkatsforce](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
After Delete trigger functionality
i want to delete a child record when parent record is delete after a trigger fires........example plzzzzzzz
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
i want to delete a child record when parent record is delete after a trigger fires........example plzzzzzzz
if(Trigger.isDelete)
{
Set setdeleteId = new Set();
for(Contact delc : trigger.old)
{
setdeleteId.add(delc.Id);
List delcont =[Select Id,Contact__c from CustomDetails__c where Contact__c=' '] ;
delete delcont;
}
}
All Answers
What kind of relationship you have,if it is a Master Detail it would delete the child records automatically.
the below works assuming it's not a m-d relationship, in which case you don't need any code
i use the lookup relationship for parent-child.......
if(Trigger.isDelete)
{
Set setdeleteId = new Set();
for(Contact delc : trigger.old)
{
setdeleteId.add(delc.Id);
List delcont =[Select Id,Contact__c from CustomDetails__c where Contact__c=' '] ;
delete delcont;
}
}