Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need some quick help. I have created the following validation rule (See below) However I don’t want the validation rule to fire if User id = 00550000000lxVg

i think it be something like $UserRole.ID<> "00550000000lxVg" But where do i put this in my current validation ?

ISPICKVAL(Pension_Fund_Type__c, "")

Looking forward to your help

share|improve this question
up vote 4 down vote accepted

If it is the userID you want to allow through, your validation rule will look like this:

 $User.Id == '00550000000lxVg', false,
 CONTAINS( TEXT(Client_Business_Type__c), 'Pension' ) && ISPICKVAL(Pension_Fund_Type__c, "")

What this does is evaluate the $User.Id, and if it matches the given on, simply returns false (which passes the Validation rule) otherwise (i.e for all other users) it goes on to evaluate your validation rule against the current criteria.

Obviously the hard-coding of ID values anywhere makes one shudder with the possibilities, but I am sure I too in the past have done this in Validation rules to allow certain Roles to skip them.

Incidentally in your question you do ask about a User ID being equal to something, and thenin your supposition you mention User Role Id - so make sure you have that bit clear in your mind too?

As an extra, you can "chain" these easy enough to "add" other users to the condition like this:

IF($User.Id == '00550000000lxVg', false, 
IF($User.Id == '00550000000lxWf', false, 
    CONTAINS( TEXT(Client_Business_Type__c), 'Pension' ) && ISPICKVAL(Pension_Fund_Type__c, "")

(remembering to close the relevant number of parentheses at the end) as the execution will just pass from IF to IF either escaping as false or moving on to the next evaluation.

share|improve this answer
HI Simon -All i want to do is say if user id = 00550000000lxVg then skip validation however if any other user id validation needs to apply. So i assume this will be correct IF( $User.Id == '00550000000lxVg', false, CONTAINS( TEXT(Client_Business_Type__c), 'Pension' ) && ISPICKVAL(Pension_Fund_Type__c, "") ) – user8746 Jun 11 '14 at 15:03
yep. that's spot on. as per my first bit of code snippet. just thought an explanation + extension might be useful for future people who come across this via searching :) – Simon Lawrence Jun 11 '14 at 15:18
You could refine this by keeping the user ID in a label (eg. $Label.Privileged_User_ID ). – Jagular Jun 11 '14 at 15:20
Hi Simon- Thank you for detailed explanation. it will help me in the future :) i may need to exclude different user ids. so it will def help :) – user8746 Jun 11 '14 at 15:29

Alternative, you can use:

AND($User.Id != '00550000000lxVg', CONTAINS( TEXT(Client_Business_Type__c), 'Pension' ) && ISPICKVAL(Pension_Fund_Type__c, ""))

Same thing but formatted for easier reading:

  $User.Id != '00550000000lxVg',
  CONTAINS( TEXT(Client_Business_Type__c), 'Pension' ) && ISPICKVAL(Pension_Fund_Type__c, "")

EDIT: You can add as many parameters as you want within the AND.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.