Loading

Prevent the Modification of Closed Won and Closed Lost Opportunities with Validation Rules in Salesforce

Дата публикации: Oct 9, 2026
Описание

Some organizations do not want Users to modify Opportunities once they have been closed, regardless of whether they are 'won' or 'lost.' This article shows two Salesforce validation rule approaches for preventing edits to closed Opportunity records.

Решение

This article explains how to create validation rules in Salesforce that prevent Users from editing Closed or Closed Won Opportunity records unless they are assigned to a specific Profile. The examples below use example Profile IDs in the formula syntax. Note that the IDs used below will vary by organization.

How to Create a Validation Rule on the Opportunity Object

  • In Salesforce Classic: Setup | Customize | Opportunities | Validation Rule
  • In Lightning Experience: Gear icon | Setup | Click Object Manager | Opportunity | Validation Rules

Validation Rule for Closed Opportunities

The following validation rule allows only Users who are assigned to one of the listed Profile IDs (for example, System Administrator "00et0000000q111" or Sales VP "00et0000000q222") to edit closed Opportunities.

Validation rule syntax:

AND(

PRIORVALUE( IsClosed ) = True,

NOT(OR(

$Profile.Id = "00et0000000q111",

$Profile.Id = "00et0000000q222"))

)

Validation Rule for Closed Won Opportunities

The following validation rule allows only Users who are assigned to the single Profile ID below (for example, System Administrator "00et0000000q111") to edit Closed Won Opportunities.

Validation rule syntax:

AND(

ISPICKVAL(PRIORVALUE(StageName),"Closed Won"),

NOT($Profile.Id = "00et0000000q111")

)

Notes About These Validation Rules

  • This rule will allow any User into the 'edit' mode, but will prevent save, showing validation rule error message upon save.
  • This rule will not allow a new 'Add Product' on the Opportunity Line Items, unless you are the Profile ID listed. For non-system administrators, the validation rule will trigger on the 'Save' page of the 'Add Product' process.
  • This rule will not prevent the edit of existing Opportunity Line Items, for both system administrators and other profile Users.
  • Other examples of useful validation rules can be found in the Help and Training here: Examples of Validation Rules.
Номер статьи базы знаний

000385070

 
Загрузка
Salesforce Help | Article