Loading

Prevent the modification of 'Closed Won' and 'Closed Lost' Opportunities with validation rules

Publiceringsdatum: Oct 13, 2022
Beskrivning

Some organizations do not want Users to modify Opportunities once they have been closed, regardless of whether they are 'won' or 'lost.'

Lösning


Here are two approaches to preventing Users from editing Closed or Closed Won Opportunity records. The examples below use example profile IDs in the formula syntax. Note that the IDs used below will vary by organization.
 

To create a validation rule in Opportunity 

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



CLOSED
The following validation rule will only allow Users to edit closed Opportunities if they are assigned to a Profile ID listed (For example, System Administrator "00et0000000q111" or Sales VP "00et0000000q222") will be able to edit the Opportunity.

Validation rule syntax:

AND(
PRIORVALUE( IsClosed ) = True,
NOT(OR(
$Profile.Id = "00et0000000q111",
$Profile.Id = "00et0000000q222"))
)


CLOSED WON
The following validation rule will only allow Users to edit closed or won Opportunities if they are assigned to single profile ID below (For example, System Administrator or "00et0000000q111") will be able to edit the Opportunity.

AND(
ISPICKVAL(PRIORVALUE(StageName),"Closed Won"),
NOT($Profile.Id = "00et0000000q111")
)


Notes:

  • 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.
Knowledge-artikelnummer

000385070

 
Laddar
Salesforce Help | Article