+ Start a Discussion
Sammy7Sammy7 

Allow only sys admin to change stage name validation rule not working

HI, 
 I have the following validation rule: 
AND( 
$Profile.Name <> "System Administrator", 
ISCHANGED(StageName), 
(TEXT(StageName) = "Closed Lost" || TEXT(StageName) = "Closed Won"))

I want only the system admin profile to able to close opportunity. Yet, I logged in as a std user and was able to create a new opportunity and set the stage to closed won and it saved the record....
Best Answer chosen by Sammy7
Sammy7Sammy7
Actually, it was working but not with new records. So fixed it by adding ISNEW(). 
Thanks.

All Answers

sfdcMonkey.comsfdcMonkey.com
try this onces
AND( 
$User.ProfileId != "00ed0000000vQrA" , 
ISCHANGED(StageName), 
(TEXT(StageName) = "Closed Lost" || TEXT(StageName) = "Closed Won"))

Thanks
let me inform if it helps you

 
Sammy7Sammy7
Actually, it was working but not with new records. So fixed it by adding ISNEW(). 
Thanks.
This was selected as the best answer
ManoharKumar0408ManoharKumar0408

Not sure if it help anyone, but i had same kind of requirement. And in my case also, validation was not working. 

The problem was, i was using pciklist option API name. I had to use pikclist option lebal name.