Sometimes a controlled cleanup requires an exception to a business rule. Deactivating the rule opens the exception to everyone. A custom permission gives the rule a specific access check that you can grant to selected users. Keep the exception small and document why it exists.
Example: a historical Opportunity cleanup
In this fictional org, every Closed Won Opportunity must have a purchase-order number. A data steward needs to correct imported historical records while the missing numbers are being recovered. Use an approved, temporary exception for this one requirement. Do not create a general permission to skip every validation rule.
The example assumes a custom Text field named Purchase_Order_Number__c. Create that field in a sandbox if you want to reproduce the exercise, or substitute your actual field API name. Check that your org supports creating custom permissions; Salesforce notes that Group and Professional editions can install them from managed packages but cannot create or edit them.
1. Define the access check
In Setup, open Custom Permissions and create a permission labeled Bypass Opportunity PO Requirement, with API name Bypass_Opportunity_PO_Requirement. Describe the approved cleanup purpose and the specific rule it controls. A custom permission has no effect until a formula or other implementation checks it.
2. Put it in a focused permission set
Create a permission set labeled Opportunity PO Cleanup Exception. Open its Custom Permissions section, click Edit, move the new permission into the enabled list, and save. Keep unrelated permissions out of this set. Do not add it to a broadly assigned profile or job group just to simplify assignment.
3. Add the check to the validation formula
In Object Manager, open Opportunity → Validation Rules. For this exercise, use this error-condition formula:
AND(
ISPICKVAL(StageName, "Closed Won"),
ISBLANK(Purchase_Order_Number__c),
NOT($Permission.Bypass_Opportunity_PO_Requirement)
)The save is blocked when the Opportunity is Closed Won, the PO field is blank, and the running user lacks the permission. If your org uses a different won-stage label, replace the example value. Show a useful field-level message such as “Enter a purchase-order number before saving a Closed Won Opportunity.”
When adapting an existing rule, preserve the original condition and add the permission check around it: AND(existing_condition, NOT($Permission.permission_API_name)). Review parentheses carefully. The formula references the custom permission’s API name, not the permission set’s name.
This example evaluates on every save, including edits to Opportunities already Closed Won. If your requirement is only to enforce the transition into that stage, define and test that separate behavior deliberately; do not add ISCHANGED just to make old records stop failing.
4. Assign the exception with an end date
After approval, assign the focused set only to the cleanup user. Where assignment expiration is enabled in User Management Settings, use Manage Assignments → Add Assignment and choose an expiration date and time zone. Salesforce expires the assignment at 11:59 p.m. on the selected date in that time zone. An end-of-day expiration is not an hourly maintenance window; remove the assignment sooner when the work ends.
Record the owner, business reason, scope, expiration, and cleanup verification in your change ticket. The data steward still needs the normal object, field, and record access required for the work. This permission does not grant those permissions or bypass other rules.
5. Test the boundary before deployment
- Normal user, Closed Won, blank PO: the save must fail with the configured message.
- Normal user, Closed Won, populated PO: the save should pass this rule, subject to other org controls.
- Exception user, Closed Won, blank PO: this rule should allow the save. Verify the resulting record.
- Either user, another stage: this rule should not reject the save for a blank PO.
- Exception removed or expired: repeat the blank-PO test and confirm the save is blocked again.
- Other invalid data: confirm unrelated validation rules still block the exception user.
Run these checks as representative users in a sandbox. For imports and integrations, repeat with the actual executing account and import method. A test made only as your administrator account can hide unintended permission grants.
Limitations and rollback
An expired assignment does not remove the same permission granted by another permission set, group, or profile. Review every source when the user still bypasses the rule. Salesforce also documents that expired assignments remain assigned even though their permissions no longer apply; do not infer active access from an assignment row alone.
A user-level exception applies to any record satisfying this rule while that user has the permission; it does not automatically restrict the exception to the approved CSV or batch. Use an appropriate dedicated account and review the affected records. Before production, deploy the custom permission, permission set, and formula together through your normal change process. The immediate access rollback is to remove the exception assignment; retain the business rule and confirm ordinary validation resumes.
Related reading
Permission set groups: organize access around the job · Test duplicate rules before a Salesforce data import
Official Salesforce references
- Reference a custom permission in a validation formula
- Trailhead: Bypass Your Validation Rules
- Enable custom permissions in permission sets
- Set assignment expiration details
- Permission assignment expiration considerations
Published October 10, 2026. Official references checked on this date. The scenario and field are examples, not a claim about your org.