I Have Validation rules with below rule OR(Profile.name='Pname1',Profile.name='Pname',Profile.name='Pname3', and so on....) I have almost 100 profile names which i am not able to listed down in one validation rule.

workaround please. I have created 2 validation rules instead of one. But is there any solution ,so i can use only one validation rule. Please Suggest

  • Could you not just do profile.name != ?
    – Girbot
    Commented Nov 5, 2015 at 8:55
  • I have total 250 profiles ,so if i used != still it will not work Commented Nov 5, 2015 at 10:25
  • How many profiles do you need to include versus exclude? Alternatively Is it an option to add a custom field on the user record and use that instead?
    – Girbot
    Commented Nov 5, 2015 at 10:31
  • I have total 200 Profiles from which 90 profiles needs to be included and remaining needs to be excluded.Unfortunately cannot use custom fields because of some restrictions Commented Nov 5, 2015 at 11:11
  • is this possible if i create a custom label and used CONTAINS for ex: CONTAINS($Label . Profiles_name, text 2) Here how can i compare..can you please complete formula if you can Commented Nov 5, 2015 at 12:42

2 Answers 2


I can think of a few different approaches that you could take here. These suggestions may be able to be combined.

Option 1

Consider using $UserRole instead of $Profile. This would benefit you if multiple profiles are covered by a single role

Option 2

Use the CASE() function to remove as much repetition as possible. This would look like

        'PName1', 1,
        'PName2', 1,
        'PName90', 1,
    ) > 0,

In this example, if the profile name was one of the 90 specified, the validation rule would trip, preventing the operation from occurring. It's easy enough to flip around so that the 90 specified profiles would be allowed to complete the operation.

Option 3

Handle this with a Hierarchy Custom Setting. It'd have at least one checkbox. Set the default value for the org to true or false, then add your 90 profiles, setting the value to the opposite of the default org value.

Assuming your Custom Setting is named MyCustomSetting, and your field is named AllowOperation you validation rule would become simply


The downside of using a Custom Setting is that you would need to re-enter the data in any sandboxes you have (after creating or refreshing the sandbox, except for full copy sandboxes, and maybe partial copy sandboxes as well). You could use the DataLoader to manage this, but it is an extra step.

If you need to use this same profile-checking logic in multiple validation rules (and/or in apex or Visualforce pages), it may be worth it to go with the Custom Setting route.

If this is a one-off validation rule, I'd suggest trying to combine options 1 and 2.

  • is this possible using custom label? like if(ISCHANGED(profile.name and contains(Customlable) then fire validation rule Commented Nov 10, 2015 at 6:38
  • It looks like this is possible in the form of CONTAINS($Profile.Name, $Label.<label name>); however, the limit on the value of a custom label is 1000 characters, which is more restrictive than the character limit of validation rules. While it is possible to use multiple custom labels, this really isn't what that functionality was built to do. Trying to force a square peg through a round hole will only make your solution harder to maintain.
    – Derek F
    Commented Nov 10, 2015 at 17:26

One approach that can be used recently is by using Custom Permissions.

You can create custom permission, assign the permissions to the covered profiles and your Validation rule can be written from

ISCHANGED(CloseDate) &&
OR(Profile.name='Pname1',Profile.name='Pname',Profile.name='Pname3', and so on....) 


ISCHANGED(CloseDate) &&

The custom permission is like adding a new checkbox in a profile. In this case the ability to pass the validation. In my example, I want to change the Close Date in an opportunity. I add the permission that can be named Can_Change_CloseDate to all profiles o user through Permission Set and using the merge field


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .