# Prevent Closed Won Opportunities from Reopening

**Type:** Apex trigger · **Difficulty:** Medium · **Object:** Opportunity · **Topics:** Opportunity, Trigger.oldMap, Before Update

Practice this problem interactively (write and run your Apex trigger against realistic data): https://www.forcechallenges.com/problems/prevent-closed-won-opportunity-reopening

## Problem

When an Opportunity is already Closed Won, do not allow users to change its Stage to anything else. New Opportunities can use any valid stage. Use Trigger.oldMap to compare the previous and new values.

## Constraints

Write bulk-safe trigger logic. Do not run SOQL or DML inside a loop.

---
Source: ForceChallenges · last updated 2026-10-13
