5

I am new tot validation rules. I am trying to allow three users and the system Administrator profile to update and an Opportunity set to ‘Closed Won.’ No other users should be allowed update. My returns an error message when I login as one the three user who need to update. When I comment out the NOT line everyone can update. What am I not seeing?

AND(
  ISPICKVAL(Stagename, 'Closed Won'),
 NOT(
    OR(
         $User.Id = '005F000000431Qxxx1',
         $User.Id = '005F000000431Pxxx2',
         $User.Id = '005F0000005tuHxxx3',
         $Profile.ID = '00eF0000001B2gxxxC'
   ) 
 ) 
)

Also, do you know where I can find documentation to help me with Not, OR, etc. ?

1 Answer 1

3

I would just use != (not equals) instead of the NOT() function.

AND(
  ISPICKVAL(Stagename, 'Closed Won'),
  $User.Id != '005F000000431Qxxx1',
  $User.Id != '005F000000431Pxxx2',
  $User.Id != '005F0000005tuHxxx3',
  $Profile.ID != '00eF0000001B2gxxxC' 
)

Also, just to note, this not only prevents them from changing the status to Closed Won, but also prevents then from editing the opp once it is closed won. This may be what you want, in that case its fine. Just wanted to point it out in case you thought it was only preventing them from changing the stage to Closed Won.

1
  • I did more testing and it looks like I don’t want the error message to show up. That occurs when “Closed Won” is true and any one of the User.Id is making the update because those are my valid updaters. Thanks so much for your help.
    – G. Clak
    Commented Sep 13, 2015 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .