Trigger to prevent deletion of account if child cases exist
trigger AccountTrigger on Account (before delete) { map<id,account>accmap=new map<id,account>( [select id, (select id from cases) from account where id in:trigger.oldmap.keyset() ]); for (account a :trigger.old){ if(accmap.get(a.id).cases.size()>0){ a.adderror('you cannot delete the…