Data Validation & Validation Rules in Salesforce Admin Tutorial

Data Validation & Validation Rules in Salesforce Admin Tutorial

On February 6, 2022, Posted by , In Salesforce Admin, With Comments Off on Data Validation & Validation Rules in Salesforce Admin Tutorial

Data validation refers to an activity of making sure that the entered data is meeting all the specified standards defined. Some of the benefits of data validations:

  1. Up-to-dated data
  2. Improved data quality 
  3. Easy to run analytical reports on cleaner data 
  4. High data completeness

Types of data validation in salesforce 

  1. Data validation of fields
  2. Making Required fields 
  3. Validation rules 

Making Required fields

Certain fields can be marked as required on the basis that whether the record necessarily needs the field value for its existence or its value is just needed on the basis of certain fields or conditions. It can be achieved by following ways:

  1. Marking a field as “Required” while creating a field:

    In this record can not be saved in the database without populating the field that is marked as “Required”. In this no matter what the User profile or Page layout is. Only certain fields can be marked as required. 


Steps to mark a field as “Required” on object level

  1. From the setup, select the tab “Object Manager”.
  2. Select the object say “Account”.
  3. Select “Fields & Relationships” from the sidebar.
  4. Create/Select(Edit) the field that needs to be made “Required”.
  5. In the section “General options”, flag the “Required” checkbox as selected. (Description as “Always require a value in this field in order to save a record” ). Refer the screenshot below:
  1. Marking a field as “Required” on the Page Layout

These types of use cases generally arise when we need to make a particular set of fields to be filled on a conditional basis or by only a set of users. It can be defined on the basis of different business processes where we generally have different page layouts and inputs are captured from various user teams like sales team, marketing team, finance team etc.

Steps to mark a field as “Required” on object level

  • From the setup, select the tab “Object Manager”.
  • Select the object say “Account”.
  • Select “Page Layouts” from the sidebar.
  • Select any existing page layout or create a new page layout.
  • On the page layout detail page, scroll to the field that needs to be made “Required”
  • “Wrench” icon will appear on hovering the field say Account field named “Active”. Refer the screenshot below’
  • Select the needed checkbox from pop-up that appears to make a field required. Refer the screenshot below:
  • Click OK and then Quick Save or Save.

Validation Rules

When the data validation defined as per business processes can not be controlled by means of restriction on field and page layout, then we can use another very strong and flexible automation of salesforce which is called as “Validation Rules”. 

Validation rules use the formulas to define the criteria: single or multiple that must be verified in order to save the record. If the defined rules are not met then admin-defined error messages will be displayed to the users, so that they can take the needed steps to pass the verification process. 

Steps to setup validation rules:

  • Object Selection: First of all we need to choose the object: standard or custom on whose records we need to apply validation rules.
    1. From the Object Manager in Setup, navigate to the object.
    2. Click on the “Validation Rules” in the sidebar.
  • Define the “Rule Name” for the validation rule
  • Mark it as “Active” using the checkbox
  • Enter the “Description” which can be a short note to define the purpose of the rule.
  • In the “Error Condition Formula” section, define the formula expression that will be evaluated to decide whether the error message defined in the next section will be displayed or not. If the error formula evaluates to “TRUE”, then the error message is displayed otherwise the record is saved.
  • Error Message” section:
    • Error Message: This input field is used to define the message that we need to display to the user when the specified rules on a record are not met or we can say when the error condition evaluates to true mentioned in the above section
    • Error Location: This is used to select the location of an error message i.e. whether it will be displayed at the top of the page or below a specific field.
  • Click “Save” or “Save & New” to create a new validation rule.
Comments are closed.