Sample User, Role, and Profile Validation Rules
Examples on how to validate custom user, role, and profile fields.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, Developer, and Database.com Editions |
For more information on any of the formula functions used in these examples, see Formula Operators and Functions.
Discount Percent Does Not Exceed Role-Based Limit
| Field | Value |
|---|---|
| Description: | Validates that a custom field on opportunities called Discount Percent does not exceed a maximum value that varies depending on the user’s role. The default maximum is 15%. |
| Formula: | |
| Error Message: | Discount (%) exceeds limit allowed for your role. |
| Error Location: | Discount Percent |
Expense Amount Does Not Exceed User's Max Allowed Expense
| Field | Value |
|---|---|
| Description: | Validates a custom field called Expense Amount against a custom user field called Max Allowed Expense. |
| Formula: | |
| Error Message: | Amount cannot exceed your maximum allowed expense. |
| Error Location: | Expense Amount |
Only Record Owner Can Change Field
| Field | Value |
|---|---|
| Description: | Ensures that only the record owner can make changes to a custom field called Personal Goal. |
| Formula: | |
| Error Message: | Only record owner can change Personal Goal. |
| Error Location: | Personal Goal |
Only Record Owner or Administrator Can Change Field
| Field | Value |
|---|---|
| Description: | Ensures that a user can make changes to a custom field called Personal Goal only if the user is the record owner or has a custom profile of “Custom: System Admin.” |
| Formula: | $Profile merge fields are only available in Enterprise, Unlimited, Performance, and Developer Editions. |
| Error Message: | Only record owner or administrator can change Personal Goal. |
| Error Location: | Personal Goal |
Opportunity Close Date Can Only Be Back-Dated by Administrator
| Field | Value |
|---|---|
| Description: | Validates that the Close Date of an opportunity does not fall prior to the current month, except for users who have a custom profile called “Custom: System Admin.” |
| Formula: | $Profile merge fields are only available in Enterprise, Unlimited, Performance, and Developer Editions. |
| Error Message: | Close Date cannot be prior to current month. |
| Error Location: | Close Date |
Did this article solve your issue?
Let us know so we can improve!

