# Bypass Validation Rules

{% embed url="<https://www.youtube.com/watch?index=21&list=PLS9gb0Qneac2EIlybS-X1aC418MDsAasb&pp=iAQB&v=kXz4OoSaGns>" %}

### Bypass Validation Rules with Permission Sets

#### Overview

This document explains how to use a permission set to bypass any validation rule that you have in place in Salesforce. This can be useful in cases where you need to allow certain users to update a record without having to meet the validation criteria.

#### Prerequisites

* You must have the "Manage Permission Sets" permission.
* You must have the "Edit" permission on the object that you want to bypass the validation rule for.

#### Steps

1. Create a new permission set.
2. Add the "Bypass Validation Rules" custom permission to the permission set.
3. Assign the permission set to the users who need to bypass the validation rule.
4. Edit the validation rule and add the following formula to the "Error Condition Formula" field:

```
NOT(ISPICKVAL(PermissionSetGroup.BypassValidationRulesV2, TRUE))
```

This formula will evaluate to true if the user does not have the "Bypass Validation Rules" permission set assigned to them. In this case, the validation rule will be triggered and the user will not be able to save the record.

#### Example

In the example below, we will create a permission set that allows users to bypass the validation rule on the Opportunity object that prevents users from saving an opportunity without an implementation fee.

1. **Create a new permission set.**

* Click on the **Setup** gear in the top right corner of the Salesforce home page.
* Select **Users** > **Permission Sets**.
* Click on the **New** button.
* Enter a name for the permission set, such as "Bypass Validation Rules V2".
* Click on the **Save** button.

2. **Add the "Bypass Validation Rules" custom permission to the permission set.**

* Click on the **Custom Permissions** tab.
* Select the "Bypass Validation Rules V2" permission.
* Click on the **Add** button.
* Click on the **Save** button.

3. **Assign the permission set to the users who need to bypass the validation rule.**

* Click on the **Users** tab.
* Select the users who need to bypass the validation rule.
* Click on the **Assign Permission Set** button.
* Select the "Bypass Validation Rules V2" permission set.
* Click on the **Assign** button.

4. **Edit the validation rule and add the following formula to the "Error Condition Formula" field:**

```
NOT(ISPICKVAL(PermissionSetGroup.BypassValidationRulesV2, TRUE))
```

* Click on the **Setup** gear in the top right corner of the Salesforce home page.
* Select **Objects** > **Opportunity**.
* Click on the **Fields & Relationships** tab.
* Select the "Implementation Fee" field.
* Click on the **Validation Rules** tab.
* Click on the **New** button.
* Enter a name for the validation rule, such as "Implementation Fee Required".
* Select the "Error Condition Formula" field.
* Enter the following formula:

```
NOT(ISPICKVAL(PermissionSetGroup.BypassValidationRulesV2, TRUE))
```

* Click on the **Save** button.

#### Testing

To test the validation rule, create a new opportunity and try to save it without entering an implementation fee. You should see an error message that prevents you from saving the opportunity.

Now, assign the "Bypass Validation Rules V2" permission set to the user who is trying to save the opportunity. Try to save the opportunity again. This time, you should be able to save the opportunity without entering an implementation fee.

#### Conclusion

By using a permission set, you can easily bypass any validation rule that you have in place in Salesforce. This can be useful in cases where you need to allow certain users to update a record without having to meet the validation criteria.
