Prevent Deleting Contacts Linked to Open Opportunities
HardApex Triggeron Contact 50 ptsCreated Oct 13, 2026
Before a Contact is deleted, check whether the Contact is selected as the custom Client_Contact__c on any open Opportunity. If so, block the deletion and explain why. Check all Contacts in the delete batch with one query.
Constraints
Use bulk-safe trigger logic. Do not run SOQL or DML inside loops.