0

Salesforce.com >> Using a validation rule, how to allow specific users to create a new record on Account and restrict other users?

In my org, a validation rule is already present to restrict the user from creating the new account except for a few users who are allowed to create a new account. Such authorized users can do this with a permission set that is assigned to their user configuration. Also, validation is already present which restricts all other users to enter a new account/data. In this validation, user ids are hard-coded as authorized users are not supposed to encounter this validation which working on the account. Is there any way to avoid hard-coding of user ids and keep the application working as expected?

1 Answer 1

5

A nice way to do this is to use custom permissions. With this you can create your very own permissions that can be added to profiles or permission sets. You can then insert a check for this permission in the validation rule itself.

For example, if you created a custom permission "Bypass Validation X" ("X" representing the meaning of the validation to be bypassed) you can add that to profiles or permission sets and do something like the following in your validation rule:

NOT($Permission.Bypass_Validation_X) AND (...)

Where "..." is the original validation rule content without any user ID checking parts.

Only users with the required custom permission will be able to bypass the validation.

1
  • A big thank you Phil W, as my issue is resolved with this option. Regards!
    – Neha
    Commented Aug 11, 2020 at 17:09

You must log in to answer this question.

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