11 answers

Hi Tad ,The reason you are not able to use your trigger for both the conditions is due to contains method that that is trying to compare null value of your Contact_type__c field.Simply make use of == operator to get result for the same. Please try this simple code to get expected results.trigger ShowError on Account (before delete) { for(Account acc : trigger.old){ String str= acc.Contact_type__c; if(str=='Signatory' && acc.Application_status__c == 'Approved'){ acc.adderror(':::Signatory Accounts cannot be deleted. Please contact administrator if you need it to be deleted or merged'); } }} I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.Thanks and Regards,Deepali Kulshrestha