public static void PreventEmployeeDeletion(List<Employee__c> empList) { for (Employee__c emp : empList) { if (emp.isActive__c == true) { emp.**addError('Record cannot be Deleted as isActive is True.')**; } } }