Special OFFER: 1st Enroll Flat 25% OFF OR 2nd Enroll Get 40% OFF | Use Coupon JTOFFER25

- Salesforce Blogs -

What Are The Validation Rules? How To Create Salesforce Validation Rules?


Validation rules in Salesforce are quite important especially at the time when the data quality has to be maintained. Data is an essential part of any organization and the quality of data that is inserted by the user can be improved easily by applying the validation rules. In these rules, records are saved if the input is fine, otherwise, in case of any conflict, the error is displayed and records are not saved. Salesforce applications can be created with the validation rules for that Salesforce has provided certain features.  This article will throw a lot of light on the steps that are followed to create these validation rules in Salesforce and you can work on your knowledge about Validation rules and how to create them by following a self-learning tutorial. So, go for it and begin the learning process.

What are  Validation Rules in Salesforce?

You must know the brief detail on what are validation rules in Salesforce before you can tackle the part about learning on how to create them. Validation rules in Salesforce are used to test whether the data that is entered by the user follow and meet the standards that are specified by you before the step to save the records. The rules of validation may contain expressions or formulas that are used to evaluate the data, the rules may return Boolean values that can be true or false. In case, if the validation rule results in True value then an error message can also be displayed to show the rule validity.

Workflow validation rules can also be specified that consist of a series of actions that can reflect the business process. The workflows are usually started and initialized when any specific field or record meets certain criteria. These workflows can automate standard internal procedures and processes that can save time across the organization. Workflow rules are like containers of workflow instructions that may include validation rules.

Also, make sure to spend some time with validation rules in Salesforce examples to get a clear understanding of the concept. Do you think you should acquire more Salesforce knowledge? 

Read: What is Salesforce? The Intriguing World of Salesforce in 2020

Take an online Salesforce Training course with us and become a Salesforce expert from the comfort of your home.  

Salesforce Training For Administrators & Developers

  • No cost for a Demo Class
  • Industry Expert as your Trainer
  • Available as per your schedule
  • Customer Support Available

How do Validation Rules in Salesforce Work?

Now, you might have been familiar with the validation rules and why they are used. Mainly validation rules are used to validate the data that is being given by the user. The user can create one or more validation rules to validate data and if the rule violated, an error message is usually displayed on the screen. Some facts related or associated with validation rules are:

  • The validation rules are usually executed when the user save data.
  • If the validation rule contains an evaluation expression or formula then it may return True or False values. The error message is usually displayed at the top of the page or below the field that is associated with the error message.
  • When the rules are being written for the fields or the set of the fields then anyone of the below-listed action gets executed when you will click on the save button:
  • Salesforce executes the validation rules that are specified by the user and if data is found validated then the record is saved otherwise it is not being saved.
  • If invalid data is being entered by the user then an error message will be displayed
  • In case if the field that is associated with the validation rule is not displayed in the page layout, still the validation rule will be applied and if the rule fails in validation then an error message will be displayed on the screen.

Learn Salesforce in the Easiest Way

Read: VisualForce Component: Type of VisualForce Component in Salesforce
  • Learn from the videos
  • Learn anytime anywhere
  • Pocket-friendly mode of learning
  • Complimentary eBook available

How to Create Validation Rules in Salesforce?

Here in this section, we shall discuss how to create validation rules in Salesforce. Validation rules are not specific and the user can create the rule as and when required. For single or multiple fields, the rules can be created. Here we are going to discuss these rules and the way in which they are created. Below-listed steps are followed to create the validation rules in Salesforce for any Salesforce applications:

  • In the Salesforce application dashboard, go to the Setup and then select Object Manager and select Account afterward.
  • From here, select Validation Rules and click New.
  • In the Rule Name field, enter text like “Expiration Date is Required”.
  • Select Active by ticking the field and make sure that is selected.
  • In the Description box, enter the description like “Expiration date is required for the accounts that are valid”.
  • In the box of Error Condition Formula, you can enter the following formula: Has Support Plan c = True && IS BLANK (Expiration Date c)
    1. As per this formula, the condition “Has Support Plan c” and ISBLANK fields validate true then the error message that will be defined by the user be flashed otherwise it will not be displayed.
  • Here, Check Syntax to make sure that no error is there in the field.
  • Now, you should enter the error message like given below “An expiration date is expected to validate the account”
  • Now, select the field as error location and the validation field must also be saved
  • Finally, click on ‘Save’.

Now create opportunity validation rule to force users so that they can enter a close reason for the opportunity stage that is closed lost. Following steps are to be followed to create the opportunity rules in Salesforce:

  • Go to Setup and click Object Manager then select Opportunity
  • Now select Validation Rules and click New
  • Now enter the Rule Name and enter the text like “When lost provide the close reason”
  • Select Active
  • In Description box enter the description like “To close the opportunity a reason is required”
  • In error condition box enter the formula “ISPICKVAL (Stage Name, “Closed Lost") && ISBLANK (Close Reason c)”
  • Now click on Check Syntax to make sure that there is no error
  • In Error message text box enter the text like “A close reason is required when the opportunity is closed or lost”
  • For Error Location choose the Field and same has to be chosen for Close Reason specification
  • Click on Save

In this way, you can create the validation rule for opportunities. For any number of fields, the rules can be created moreover you can select one or more fields for single rue. Means if you require more than one field for validation then choose accordingly.

Take a demo of our online Salesforce training today!

Read: An Ultimate Guide to Salesforce Controllers

Salesforce Training For Administrators & Developers

  • Personalized Free Consultation
  • Access to Our Learning Management System
  • Access to Our Course Curriculum
  • Be a Part of Our Free Demo Class

Final Words:

The validation rules in Salesforce are essential and can include formula fields, lookup filters, and record types. You can also set up page layouts and track the field history as well. Even sales, service and ops team members can also perform their job in a better way if they will use these validation rules to validate the data. They can even be customized and can be used to import data. The validation rules can be easily defined by even any non-technical person if they want to validate a field. Have a look at all the examples of validation rules in Salesforce to understand it even more. And go to Janbask Training to get your hands on more such concepts and sign up for specially designed Salesforce Courses.


Read: How to Prepare For Salesforce Developer Interview Questions?-Tips and Tricks? Beginners Tips!

Salesforce Tutorial Overview

FaceBook Google+ LinkedIn Pinterest

    Janbask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.


Trending Courses


  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53

Upcoming Class

9 days 05 Nov 2021


  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

9 days 05 Nov 2021

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

2 days 29 Oct 2021


  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

2 days 29 Oct 2021


  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

2 days 29 Oct 2021


  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

12 days 08 Nov 2021

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

2 days 29 Oct 2021

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

9 days 05 Nov 2021


  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation

Upcoming Class

9 days 05 Nov 2021

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks

Upcoming Class

10 days 06 Nov 2021

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning

Upcoming Class

23 days 19 Nov 2021


  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop

Upcoming Class

2 days 29 Oct 2021

Search Posts


Receive Latest Materials and Offers on Salesforce Course