Examples of Salesforce Validation Rules

I’ve recently written a couple Salesforce validation rules that I wanted to document and share for those trying to do something similar. First, let’s start with how to create a validation rule in Salesforce.


It is actually very easy to create a validation rule. Here are the steps…

  1. Click on Your Name -> Setup
  2. Under App Setup, click Customize
  3. Select at what level you want to apply a validation rule: Lead, Contact, Opportunity, etc
  4. Click Validation Rules
  5. Click New

Then to create a validation rule, you need to write a formula that if it does not validate to true, will return an error message that will then require the sales person to complete an action in order to make your rule validate to true.


In this first example, we wanted to start collecting data on opportunities that were older than 100 days. Why were the deals slipping? Budget? Infrastructure delays? Still testing our product? Just not responding? To do this, we decided to create a new field called “Deal Slip Reason”. If the “Deal Slip Reason” was blank and a sales person tried to edit/save an opportunity that had a “Close Date” of greater than 100 days after the “Create Date”, we would display a message alerting the sales person to complete the “Deal Slip Reason” field.

Here’s the validation rule that we used:

CloseDate – DATEVALUE(CreatedDate) > 100,
ISBLANK(TEXT( Deal_Slip_Reason__c ))


Another piece of data that we wanted to collect was the “Demo VDIO Phase” of any prospective leads that were being converted to a contact/opportunity . This meant that we needed to first validate that the “Partner” field was either blank or “N/A” as we didn’t want to ask this question if reseller partners or strategic partners were being converted this this demo phase is irrelevant to them. Next, we only wanted to apply this rule to those that were being converted and the “Demo VDI Phase” field was blank. So, here’s the complete rule we used:

OR (ISBLANK(TEXT(Partner__c)) && IsConverted && ISBLANK(TEXT(Demo_VDI_Phase__c)), TEXT(Partner__c) = “N/A”) && IsConverted && ISBLANK(TEXT(Demo_VDI_Phase__c))

Hopefully these examples of a couple of the Salesforce validation rules that I have written will help you to write some of yours. As I write more rules, I will be sure to update this post.

How to Disable Tracking Image in Salesforce Emails

When you send an email from Salesforce a 1×1 pixel image is inserted into the email. This image is used for tracking purposes. If the image that is hosted on Salesforce’s server loads, then Salesforce knows the email has been opened and will report it as such. In theory this is great, however it does have its drawbacks.

Drawback #1: Email recipients get alerted to “Download Images”

Many email clients (specifically Microsoft Outlook and Google) are setup by default to not download any images in an email. Instead they prompt the user to “download images”. If you are sending something like a newsletter where images are expected, this is probably okay. However, if you are sending what you think is a plain text email and the recipient gets this prompt – it will probably raise some red flags. Which leads to Drawback #2…

Drawback #2: Text emails with “Download Images” alert are suspicious

Personally, anytime I get what appears to be a text email and the email asks me to download images I know it was a mass email that is being tracked. Immediately you’ve lost that personal connection with the recipient and if you are in sales that is a bad thing.

So, how do you disable the tracking image in Salesforce emails?

It is actually very simple. Just follow the steps below…

1.) Go to … Your Name | Setup | Customize | Activities | Activity Settings.
2.) From there uncheck the checkbox for ‘Enable Email Tracking’

That’s it – you’re done!