You need to sign in to do that
Don't have an account?
brahmanaidu
Deleting the contact when the accountid is null
trigger ContactTrigger on Contact (before update) {
set<id> ids=new set<id>();
if(Trigger.isUpdate){
for(Contact con:Trigger.new){
if(con.AccountId==null){
ids.add(con.Id);
}
}
}
List<Contact> condata=[select Id,Name from Contact where Id in:ids];
if(condata.size()>0&& condata!=null){
}
delete condata;
}
set<id> ids=new set<id>();
if(Trigger.isUpdate){
for(Contact con:Trigger.new){
if(con.AccountId==null){
ids.add(con.Id);
}
}
}
List<Contact> condata=[select Id,Name from Contact where Id in:ids];
if(condata.size()>0&& condata!=null){
}
delete condata;
}
Thanks,
Bhanu Prakash
visit ForceLearn (https://www.forcelearn.com)for salesforce Latest Updates and development tips
let us know if it helps you and mark it best if it helps you
Let us know if this will help you