Simple Salesforce Explained: How to Get Started With Validation Rules

Share this article...

It’s easy to get overwhelmed by all of the custom configuration options that exist in Salesforce, especially as a new User or Admin. However, some config is very straightforward and easy for even the least tech-savvy User to get setup. Validation Rules are one of these. Below is a complete overview of what Validation Rules are, when to use them, how to set them up, and what they can do to help your business.

What is a Validation Rule?

A Validation Rule is a rule on a field which verifies that data entered by a User meets a certain criteria, before the User can save the record. The rule asks a Yes or No question where the answer must be Yes, or “True”. The question is asked when a User enters new data into Salesforce and goes to save the record changes.


When Should I Use Validation Rules?

Use Validation Rules in places where Users may be prone to making mistakes or when you need data to be a certain way.

Imagine that you use Opportunities to track potential sales. Your sales reps sometimes create new Opportunities leaving the “Amount” field blank due to uncertainty on what the exact value should be. You use Opportunity Stages, like “Closed Won” when a sale is finalized and won.

However, the reps may change a sale to “Closed Won” and forget to add the amount:

Without the actual sale amount, you will have messy data and trouble in the future when trying to forecast how much you’ve earned or could earn from future sales. A Validation Rule can solve this problem by preventing Users from closing an Opportunity while the “Amount” field is blank.

How is a Validation Rule Set Up?

Validation Rules can be thought of in 3 parts:

  1. Name/Description/Purpose

It may seem intuitive but it is important to have a clear name for your Validation Rule and description. Others need to understand what your rule does and why you have it in case it needs to be edited in the future by someone other than yourself. Keep it short and simple!

  1. The Rule Itself

Setting up the Validation Rule itself is the trickiest part of this process due to the Error Condition Formula. If you haven’t written a formula in Salesforce before, check out this Salesforce article before reading on. Even if you are still shaky on writing formulas, you can get started writing simple Validation Rules today.

Insert Field

This button allows lets you look at all fields in the object you are writing the Validation Rule on and find the ones needed for your formula. Use the Insert Field button to find the fields you need because sometimes they are written differently for the formula to understand. Below, the Opportunity “Stage” field is read by the formula as “StageName”.

Insert Operator

The Insert Operator button brings you to all of the different operator functions that you can use in your formula. These include Math operators like +, -, /, and more. Our formula does not need an operator.

Insert Selected Function

Functions are the most complex part of writing formulas because they may be unfamiliar to Users. There are different types of functions each doing different jobs. Luckily, Salesforce has a description of what each function does and how it needs to be set up right below it. In our formula, we need to use three functions: ISBLANK, ISPICKVAL, and AND:

ISBLANK(field) returns “True” if a specific field is blank.

ISPICKVAL(field, specific picklist value) returns “True” if a picklist value in a field matches the picklist value in the formula

AND() returns “True” if the following items or functions are both “True”

Check Syntax

This button lets you check to make sure your rule is written correctly. When you click the Check Syntax button Salesforce will even tell you what the problem is. For example, a common problem is that you are missing a parenthesis, or “)” somewhere in the formula.

Try not to get frustrated when you are first writing Validation Rules. Keep rules very simple, straightforward, with one end result in mind.

  1. The Error Message

Error messages appear to your Users when they are doing something to make a Validation Rule “True”. You want your error messages to be short and clear so Users can quickly understand what they did wrong when entering data and what they should instead.

You can also pick for the error message to show on the top of the page or near the field itself. 

How are Validation Rules Helpful to Your Business?

Our final Validation Rule:

Don’t forget to activate your rule by checking the “Active” checkbox!

Validation Rules should be incorporated into your Salesforce Org today in order to help keep your data clean and accurate. By catching and preventing mistakes on records now, you will have clearer information saved overall. This leads to more accurate analytical insights on what is happening with your business and allows you to make smarter forecasts and decisions.

Cleaner data also allows you to do other things in Salesforce in better ways. For example, if you use an app like Inspire Planner for project management, your Salesforce data is fully integrated with the app. If your data isn’t clean, you can’t fully utilize the built in time tracking and project templates because dirty data will be fed into those features and not give you true insight on how projects are really being ran. Overall, clean data is a must have, and Validation Rules are an easy way to ensure that your Salesforce Org is on its way there!

You can find an entire list of pre-made Validation Rules here!

Leave a Reply