I have few scenarios for locking the date

  1. If Closed:Won – Date locked

  2. If Stage changed to ‘Closed:Lost’ or ‘Declined’ from Closed:Won then date is changed to the date of that activity and locked again.

  3. If Stage goes from Closed:Lost, Declined or Closed:Won to anything pre Closed Won then date is unlocked and can be edited as usual.

How can I implement the above logic?


There are a few different ways to solve this, I'll list 2:

  1. Using Validation Rules, you can write a formula to prevent the field being edited based on the current and previous answers (look at Steve's answer).
  2. If your Org has the capability, you could write a Before Trigger and check both the old and new values, and decline or allow the update that way.
  1. Create validation rule:

AND( OR( ISPICKVAL(Stage, 'Closed:Lost'), ISPICKVAL(Stage, 'Declined'), ISPICKVAL(Stage, 'Closed:Won') ), ISCHANGED(CloseDate) )

With a notification "Date change is not allowed in 'Closed:Lost', 'Declined, and 'Closed:Won' stages"

  1. Create a Workflow with Evaluation Criteria Evaluate the rule when a record is created, and every time it's edited:

AND( OR( ISPICKVAL(Stage, 'Closed:Lost'), ISPICKVAL(Stage, 'Declined') ), ISPICKVAL(PRIORVALUE(Stage), 'Closed:Won') ),

with Field Update action: CloseDate = TODAY()

  • Hi do I need to create validation on stage (picklist field) or Close date field?
    – sai
    May 18 '16 at 21:20
  • Validation formula itself has all fields you need for validation. If you are asking where to show validation error - it depends, in your case I'd show error message on CloseDate, as this is the field you want to lock
    – o-lexi
    May 18 '16 at 21:30
  • Thank you for your quick response. Do I need to create Workflow too? because it is allowing me to edit close date even thought i use validation rule?
    – sai
    May 18 '16 at 21:36
  • Yes, you need WF to set CloseDate to today's date, stated in your 2nd scenario.
    – o-lexi
    May 18 '16 at 21:41
  • It is throwing me an error Error: Function PRIORVALUE may not be used in this type of formula. I tried using ISCHANGED still giving me error
    – sai
    May 19 '16 at 18:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.