1 Antwort
Hi Switi,Can you try the below Trigger on Account object.
Let me know if you face any issues.If this solution helps, Please mark it as best answer.Thanks,trigger AcountConDelete on Account (before insert) {
set<String> namestr= new Set<String>();
for(Account acc:Trigger.new){
namestr.add(acc.name);// Adding name to set
}
List<Contact> tobedeleted= [select id,name from contact where name in :namestr];//quering the contacts with that name
if(tobedeleted.size()>0)
delete tobedeleted;
}