Loading
Ongoing maintenance for Salesforce HelpRead More
Feature degradation | Gmail Email delivery failureRead More
Extend Salesforce with Clicks, Not Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Sample User, Role, and Profile Validation Rules

          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:
          Discount_Percent__c > VLOOKUP(
              $ObjectType.Role_Limits__c.Fields.Limit__c,
              $ObjectType.Role_Limits__c.Fields.Name, 
              $UserRole.Name
          )
          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:
          Expense_Amount__c > $User.Max_Allowed_Expense__c
          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:
          AND(
             ISCHANGED( Personal_Goal__c ),
             Owner <> $User.Id 
          )
          
          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:
          AND(
              ISCHANGED( Personal_Goal__c ), 
              Owner <> $User.Id, 
              $Profile.Name <> "Custom: System Admin" 
          )

          $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:
          AND(
            OR (
               ISNEW(), 
               ISCHANGED( CloseDate )), 
            CloseDate < DATE( YEAR(TODAY()), MONTH(TODAY()), 1),
             $Profile.Name <> "Custom: System Admin"
          )
          

          $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
           
          Loading
          Salesforce Help | Article