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
GambitGambit 

Validation Rule

Hi,
I am trying to define a validation rule for a picklist.
My conditions are,
If the picklist value is blank (which it will be initially), then allow the value from the picklist to be selected.
If the value isnt blank, then only one person (system admin) can change the value . If anyone else tries to change the value, an error message should be displayed.

I tried this

 
AND
((Not(ISPICKVAL( AssignedSalesEngineer__c, " "))),
ISCHANGED(AssignedSalesEngineer__c), $Profile.Id<>
"00500000006otGx")

This doesnt allow the value of the piclist to be set initially .It just pops the error message..
Can anyone help

Thanks
jvolkovjvolkov

Try this, this will trigger when the picklist is changed to a value and the user is not a sys admin.

Code:
AND( 

NOT(ISPICKVAL( AssignedSalesEngineer__c , "")), 
ISCHANGED(LeadSource),
$User.ProfileId <> "00500000006otGx" 

)


 

jvolkovjvolkov

Should have looked like this, accidentally had lead source in there, can't get lead source off my mind.

Code:
AND( 

NOT(ISPICKVAL( AssignedSalesEngineer__c , "")), 
ISCHANGED(AssignedSalesEngineer__c),
$User.ProfileId <> "00500000006otGx" 

)


 




GambitGambit
Hey, Thanks for your input.
But the problem isnt solved. Whats still happening is i cant set that field to anything.
For eg, when i create a new opportunity and i wnt to initially set a value 'xyz' to the field 'assigned_sales_engineer__c', the system should allow me to do it regardless of who i am. But when someone tries to change this value, the system should pop the error message, except for the specified $User.profile id....
 
I hope you can help me out here.
Thanks