1 2 3 4 5 6 7 8 9 10 11 12 13 14 | trigger DeleteContact on Account (After Delete) {
Set<Id>AccIdSet = New Set<Id>();
List<Contact> ConDelList = New List<Contact>();
for(Account acc : trigger.old){
AccIdSet.add(acc.id);
}
for(contact con : [Select Id, AccountId from Contact WHERE AccountId In : AccIdSet]){
ConDelList.add(con);
}
Delete ConDelList;
}
|
No comments:
Post a Comment