I have the following validation rule to prevent users from editing or creating products once the opportunity is won. The issue is that it can still be edited if they click on "edit all" in the opportunity object. Also, I would like to lock the "Quantity" and "Sales Price" once the opportunity is won. How can I do that? The code below prevents everything in the product from being edited after the opportunity has been awarded.

    ISPICKVAL(Opportunity.StageName, "WON"), 
    ISPICKVAL(Opportunity.StageName, "LOST")
  • That VR is in the opportunity object though. would I add it to that same code? – user48169 Sep 19 '17 at 14:19

You would write a validation rule on OpportunityLineItem as follows:

Opportunity.IsClosed && Opportunity.IsWon && (ISCHANGED(UnitPrice) || ISCHANGED(Quantity))

And if needed put a validation rule in Opportunity like this considering Amount is calculated based on lineItems:

Opportunity.IsClosed && Opportunity.IsWon && ISCHANGED(Amount))
| improve this answer | |
  • The first one worked like a charm – user48169 Sep 19 '17 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy