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
Lloyd RuzLloyd Ruz 

Validation Rules that affect all but one user

Is it possible to put a condition on a validation rule that will stop it from triggering for particular users?

We need a field to be uneditable (unless blank) for all but one user (our marketing automation platform Eloqua). 
Best Answer chosen by Lloyd Ruz
Mudasir WaniMudasir Wani
Dear Lloyd as Chaitanya mentioned it is possible.
I will recommand to use a custom label to compare the Id.ratherthan hardcode string.
Consider you creat a lable with the name "userIdValue" then your validation should look like
 
IF($User.Id  <>  $Label.userIdValue , value_if_true, value_if_false) 
Your current validation code should be placed at 
value_if_true and 
value_if_false should be set to false.

Like the below code
IF($User.Id  <>  $Label.userIdValue , Current Validation rule criteria, false)

Hope This helps

 

All Answers

Chaitanya Gupta KoradaChaitanya Gupta Korada
Yes if it is a full copy sandbox you can use this,as in both sanbox and production the record ids are same.
$User.Id == 'ID of the user'

Regards
Chaitanya
Mudasir WaniMudasir Wani
Dear Lloyd as Chaitanya mentioned it is possible.
I will recommand to use a custom label to compare the Id.ratherthan hardcode string.
Consider you creat a lable with the name "userIdValue" then your validation should look like
 
IF($User.Id  <>  $Label.userIdValue , value_if_true, value_if_false) 
Your current validation code should be placed at 
value_if_true and 
value_if_false should be set to false.

Like the below code
IF($User.Id  <>  $Label.userIdValue , Current Validation rule criteria, false)

Hope This helps

 
This was selected as the best answer