# Implementation summary — AN-87

**Design:** Opportunity Contact Role Close-Won Guard

## Files written
- `force-app/main/default/triggers/OpportunityTrigger.trigger`
- `force-app/main/default/triggers/OpportunityTrigger.trigger-meta.xml`
- `force-app/main/default/classes/OpportunityContactRoleGuardHandler.cls`
- `force-app/main/default/classes/OpportunityContactRoleGuardHandler.cls-meta.xml`
- `force-app/main/default/classes/OpportunityContactRoleGuardTest.cls`
- `force-app/main/default/classes/OpportunityContactRoleGuardTest.cls-meta.xml`

## Retrieved existing metadata

- Source: repo:agentnovatech-cloud/POC@main
- No existing versions found — all files are new

## Acceptance criteria

- When an Opportunity is changed to Closed Won, check whether it has at least one associated Opportunity Contact Role.
- If it has no Contact Role, block the save and display: "Validation Error: You cannot close-win this Opportunity without assigning at least one Contact Role. Please add a contact to the Opportunity Contact Roles related list and try again."
- Apply the rule to UI edits and exclude standard system integration users where applicable.