Skip to main content
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Source Link

As long as you validate based on the running user, my previous answermy previous answer applies here as well.

There are a few approaches you can take here, which I will list in order of preference. These should work just about anywhere merge fields can be used.


Create a Custom Permission

You can check if someone has a Custom Permission in a formula as follows:

$Permission.My_Custom_Permission__c

Steps:

  1. Create Custom Permission
  2. Add it to a Permission Set
  3. Assign that Permission Set to any User you wish to exempt from validation

Hierarchy Custom Setting

If you don't find the above palatable for some reason, you can also check a Hierarchy Custom Setting in a formula as follows:

$My_Hierarchy_Setting__c.Is_Exempt_From_Validation_X__c

Steps:

  1. Create Hierarchy Custom Setting
  2. Add exemption field
  3. Set Org Wide Default for this field to false
  4. Set value to true for any User you wish to exempt from validation

Alias

You can check against an Alias in a way that in all environments as follows:

$User.Alias = "analias"

Username

Somewhat less clean than Alias, but you would check against a Username as follows:

BEGINS($User.Username, "[email protected]")

User Id

I would not adopt this approach unless you have compelling reasons none of the above are a good fit:

$User.Id = "00550000000lxVg"

As long as you validate based on the running user, my previous answer applies here as well.

There are a few approaches you can take here, which I will list in order of preference. These should work just about anywhere merge fields can be used.


Create a Custom Permission

You can check if someone has a Custom Permission in a formula as follows:

$Permission.My_Custom_Permission__c

Steps:

  1. Create Custom Permission
  2. Add it to a Permission Set
  3. Assign that Permission Set to any User you wish to exempt from validation

Hierarchy Custom Setting

If you don't find the above palatable for some reason, you can also check a Hierarchy Custom Setting in a formula as follows:

$My_Hierarchy_Setting__c.Is_Exempt_From_Validation_X__c

Steps:

  1. Create Hierarchy Custom Setting
  2. Add exemption field
  3. Set Org Wide Default for this field to false
  4. Set value to true for any User you wish to exempt from validation

Alias

You can check against an Alias in a way that in all environments as follows:

$User.Alias = "analias"

Username

Somewhat less clean than Alias, but you would check against a Username as follows:

BEGINS($User.Username, "[email protected]")

User Id

I would not adopt this approach unless you have compelling reasons none of the above are a good fit:

$User.Id = "00550000000lxVg"

As long as you validate based on the running user, my previous answer applies here as well.

There are a few approaches you can take here, which I will list in order of preference. These should work just about anywhere merge fields can be used.


Create a Custom Permission

You can check if someone has a Custom Permission in a formula as follows:

$Permission.My_Custom_Permission__c

Steps:

  1. Create Custom Permission
  2. Add it to a Permission Set
  3. Assign that Permission Set to any User you wish to exempt from validation

Hierarchy Custom Setting

If you don't find the above palatable for some reason, you can also check a Hierarchy Custom Setting in a formula as follows:

$My_Hierarchy_Setting__c.Is_Exempt_From_Validation_X__c

Steps:

  1. Create Hierarchy Custom Setting
  2. Add exemption field
  3. Set Org Wide Default for this field to false
  4. Set value to true for any User you wish to exempt from validation

Alias

You can check against an Alias in a way that in all environments as follows:

$User.Alias = "analias"

Username

Somewhat less clean than Alias, but you would check against a Username as follows:

BEGINS($User.Username, "[email protected]")

User Id

I would not adopt this approach unless you have compelling reasons none of the above are a good fit:

$User.Id = "00550000000lxVg"
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

As long as you validate based on the running user, my previous answer applies here as well.

There are a few approaches you can take here, which I will list in order of preference. These should work just about anywhere merge fields can be used.


Create a Custom Permission

You can check if someone has a Custom Permission in a formula as follows:

$Permission.My_Custom_Permission__c

Steps:

  1. Create Custom Permission
  2. Add it to a Permission Set
  3. Assign that Permission Set to any User you wish to exempt from validation

Hierarchy Custom Setting

If you don't find the above palatable for some reason, you can also check a Hierarchy Custom Setting in a formula as follows:

$My_Hierarchy_Setting__c.Is_Exempt_From_Validation_X__c

Steps:

  1. Create Hierarchy Custom Setting
  2. Add exemption field
  3. Set Org Wide Default for this field to false
  4. Set value to true for any User you wish to exempt from validation

Alias

You can check against an Alias in a way that in all environments as follows:

$User.Alias = "analias"

Username

Somewhat less clean than Alias, but you would check against a Username as follows:

BEGINS($User.Username, "[email protected]")

User Id

I would not adopt this approach unless you have compelling reasons none of the above are a good fit:

$User.Id = "00550000000lxVg"