function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Validation Rule - Prevent Opportunity Edits

I'm wondering if someone can help me determine if this is possible, and if so, how to achieve it.
I want to write a validation rule that will disable a salesperson's ability to edit that opportunity once they've saved it with a stage of "closed". Can this be done? I can restrict access on an individual field level but I'm not seeing how to prevent them from making any edits whatsoever to a closed opportunity.
Any help would be appreciated, thanks.
You can do this if you're on Enterprise or Unlimited Edition.  You would create a record type for Closed Opportunities and a page layout that is read-only for all fields and associate that with the Closed Opportunity record type.  Then using workflow/field updates when the stage becomes closed you change the record type to the one for closed opportunities.
Can't this be done with a validation rule so it doesn't require Enterprise Edition? Something like

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

,$Profile.Name = "Sales" 



What good is that validation rule going to do though?  The original question was is there a way to prevent an opportunity from being able to be changed.  That means every field on the opportunity and potentially any related lists.  If you want to hard code validation rules for each field like that you could do that and it means that they can still try to edit the data and will get error messages for each and every field.

You're also limited in the number of validation rules you can have per object in Professional.  So the most of these you could have would be 20.  If you have more than 20 fields you're trying to lock down then you're out of luck

Validation rules fire when a case is true - if the user tries to make a change to any field, not just the ones in the formula, the rule will fire. Try it for yourself.

The way we set ours up is that we also prevented them from deleting closed-won and prevented them from changing or deleting line items, too. Let me know if you want any of these validation rules.

aha .. interesting.  Never thought about doing it that way.  So the only difference in our two approaches really is yours will work in PE but still presents the page layout as if someone could edit it, they just can't save it.  In mine, they can't even edit the fields so it's a perception thing but mine will only work in EE or UE.  Interesting tip though.  Thanks.
Sure thing! :smileyvery-happy:

Hi Jakester.

Sweet idea.

To simplify a little,  " IsClosed = True " also works.

How do you prevent people from changing related lists?  And how often do you get asked to make changes to opps that the sales people cannot because of these rules?




Thanks, Aiden-

I don't have sales reps asking me to un-open opps very often, but that might just be part of our culture that we don't typically close things until they are really closed. As far as related lists, I have two rules that stop any changes from the oppty line items - one is on the oppty and it checks if the priorvalue of the # of line items doesn't equal the new # of the line items - this stops any line items from being deleted. The second rule is similar to the rule we use on the oppty to prevent any changes from being made.

I'd give you the exact language, but our Salesforce server (na3) is currently down - how lame!!!


Just noticed Aiden's post about simplifying things by using "IsClosed" and want to mention it's best practice to avoid using IsClosed or IsWon opportunity merge fields in validation formulas.  Instead, use the ISPICKVAL function to determine if the Stage contains the appropriate value.  You can find this info and other best practices for Validation Rules in Help & Training.  Search for "Validation Rule Considerations".