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
Cheryl BeschCheryl Besch 

Validation rule based on Opportunity Stage Picklist and User

We want to restrict all but one user from changing the stage of an opportunity to Closed/Won.  Here is my formula below.  Any suggestions?

AND(
$User.Id="00540000002WHSSAA4",
ISCHANGED(StageName),
ISPICKVAL(StageName,"80 - Closed/Won"))
Best Answer chosen by Cheryl Besch
Ramu_SFDCRamu_SFDC
My bad I apologize, all you need to do is just put an exclamation mark (!'') to denote not equal to, Changed validation rule below

AND(
$User.Id!="00540000002WHSSAA4",
ISCHANGED(StageName),
ISPICKVAL(StageName,"80 - Closed/Won"))

Hope this helps !!

All Answers

Ramu_SFDCRamu_SFDC
Perfect !! No further changes required unless you complain it is not working ?
Cheryl BeschCheryl Besch
It is not working!  Hence, the reason for the post.  I was hoping I was missing something.  Any thoughts why it is not working?

MagulanDuraipandianMagulanDuraipandian
Never hard code values inside the validation rule.

Try trigger instead of validation rule.

If this solves your problem, kindly mark it as the best answer.
Hit Like, if it saved your work :-)

Regards,
Magulan
http://www.infallibletechie.com
Ramu_SFDCRamu_SFDC
My bad I apologize, all you need to do is just put an exclamation mark (!'') to denote not equal to, Changed validation rule below

AND(
$User.Id!="00540000002WHSSAA4",
ISCHANGED(StageName),
ISPICKVAL(StageName,"80 - Closed/Won"))

Hope this helps !!
This was selected as the best answer
Cheryl BeschCheryl Besch
Thank you!  I knew it was something simple...Thanks again!