Trigger to give error on record deletion, based on condition on parent object
trigger avoidPiDeletion on past_information__c (before delete) { list<id>conlist=new list<id>(); for (past_information__c pi:trigger.old){ system.debug('inside trigger '); conlist.add(pi.consultant__c); } map<id,consultant__c>conmap=new map<id,consultant__c>([select id from consultant__c where status__c='approved' and type__c='employee' and id in:conlist]); for(past_information__c…