0

When the status is "Completed" or "Complete" no one should be able to edit a record.

I wrote the following validation rule:

AND(OR( AND( NOT(ISCHANGED(Status)),
OR( ISPICKVAL(Status, 'Complete'), 
 ISPICKVAL(Status, 'Completed') ) ), 
 AND( ISCHANGED(Status),
OR( ISPICKVAL(PRIORVALUE(Status), 'Complete'), 
 ISPICKVAL(PRIORVALUE(Status), 'Completed')))))

But the above rule throws an error even when I'm changing the status picklist to a value other than "Completed" or "Complete".

3
  • What are you trying to achieve? Apr 19, 2019 at 9:53
  • You could also change the recordtype when status is completed and assign that recordtype to a page layout where all the fields are read only.
    – cropredy
    Apr 19, 2019 at 15:34
  • Is there a reason you're checking whether status has changed? Did you want to prevent any other edits when the status is changed to Complete as well? Apr 21, 2019 at 1:54

1 Answer 1

2

You can try like below, when old status is either Complete or Completed, it will not allow you to update the record -

AND( 
  OR( 
    ISPICKVAL( PRIORVALUE(Status), 'Complete'), 
    ISPICKVAL( PRIORVALUE(Status), 'Completed') 
  ), 
  NOT( ISNEW() ) 
)
2
  • Hi Radhe, it's working in 1 scenario but it's not working other scenarios For eg old status =working and changes to new Status = Complete this scenario it's not working Apr 19, 2019 at 12:22
  • Add one more condition for previous value of Working and new value of Complete in OR condition. Like below - AND( OR( ISPICKVAL( PRIORVALUE(Status), 'Complete'), ISPICKVAL( PRIORVALUE(Status), 'Completed'), AND(ISPICKVAL( PRIORVALUE(Status), 'Working'), ISPICKVAL( Status, 'Complete')) ), NOT( ISNEW() ) ) Apr 19, 2019 at 12:35

Your Answer

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

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