Blog

This tutorial covers some basic functions and logic that are useful when creating formulas in Salesforce. The examples below specifically refer to Validation Rule formulas, which can sometimes behave slightly different from other formulas in Salesforce.

  • When writing a new formula or validation rule, I always like to have a tab open with a  “formula cheat sheet”, like this one.

Remember:

Validation rules prevent records from being saved when the result of the tests are TRUE.

Everything inside a single validation rule is evaluated at the same time. Any criteria that needs to be evaluated needs to be defined in your formula. Sometimes that means adding a “NOT” in front of the expression.

Scenario 1Account Number field can be saved with blank values but when a value is entered, it must be numeric only.

· USE: AND so the conditions are tied together (For TRUE, all conditions must be TRUE. For FALSE, only ONE condition has to be FALSE) · USE: OR if either of the conditions returning TRUE are enough to prevent a record being saved

There are 2 logic tests here and one field referred:

Logic Test 1: NOT (ISBLANK (AccountNumber))

Logic Test 2: NOT (ISNUMBER (AccountNumber))

AND ties both conditions together

  • If a user tries to save a record but leaving the Account Number field blank. Blank is a value. The validation rule created for the Account Number field will run as follows:
  1. Is it “not blank”? False

    AND

  2. Is it “not a number”? False

The end result of this test is FALSE, therefore the record can be saved.

  • Now, if the value for Account Number is entered as “Acme”.
  1. Is it “not blank”? True

    AND

  2. Is it “not a number”? True (they’re letters)

Formula expression returns as TRUE and prevents the record from being saved.

  • Now, a new value is entered for Account Number and it’s  “12345”.
  1. Is it “not blank”? True

    AND

  2. Is it “not a number”? False

Formula expression returns as FALSE and record can be saved.

Tip: If you use this function with a picklist, use ISBLANK(TEXT(<picklist>)) to convert the picklist items into a text value.

Scenario 2: Email field must contain a valid email address format, if not blank.

      •      When there is a predictable pattern of numbers, letters and punctuation, REGEX is your friend. REGEX stands for Regular Expression and is used when you want the value to follow a specific format, such as Social Security Numbers, or Driver’s License numbers that have letters and numbers, post codes, email addresses etc.

E.G. Social Security number – an important field where not only it has to contain only numeric, but observe a specific pattern of XXX – XX –XXXX

Formula:

[crayon-611499d8bdbf3898507701/]

Note that OR is used here to prevent a record from being saved if EITHER of the conditions return TRUE.  If SSN length (LEN) is not 0 (a blank value wouldn’t cause an error message but any other random value would);

If SSN doesn’t observe the regular expression in the formula.

Note: Regular expression syntax in Salesforce is based on Java Platform SE 6 syntax. However, backslash characters (\) must be changed to double backslashes (\\) because backslash is an escape character in Salesforce. 

REGEX is also very useful when you create a validation rule that conditions one field to another. E.g., if post code is in the UK, must have [A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2} format.

Learn More:

What Certification are you studying for now?

Focus on Force currently provides practice exams and study guides for sixteen certifications

Creating Validation Rule Formulas – A Quick Tutorial

This tutorial covers some basic functions and logic that are useful when creating formulas in Salesforce. The examples below specifically refer to Validation Rule formulas, which can sometimes behave slightly different from other formulas in Salesforce. When writing a new formula or validation rule, I always like to have a tab open with a  “formula cheat sheet”, like this one. Remember: Validation rules prevent records from being saved when the result… Read More

Creating Validation Rule Formulas – A Quick Tutorial

What is the Approval Process in Salesforce?

Salesforce CRM isn’t the number one customer relationship management program for nothing. Aside from the core functionality, however, there is so much opportunity and peripheral usefulness built into the Salesforce platform that it has evolved into its own ecosystem in which organizations can live and self-sustain without much need to venture into other software. The drawback to this ecosystem is simply that each niche requires exploration to discover why, how,… Read More

What is the Approval Process in Salesforce?

Focus on People: Brian Lueken From Call Center to 16X Certified

Brian Leuken is an Application Architect for a large healthcare corporation. Rumor has it, that they have the largest Service Cloud healthcare implementation in the U.S. The implementation is growing right now – they’ve got licenses for 6,000, and it’s growing to around 21,000 in the next five years. The user population varies from frontline call center representatives to back office processing of all of the mountains and mountains of forms,… Read More

Focus on People: Brian Lueken From Call Center to 16X Certified

Offline access to your Salesforce data

Did you know that it is possible to access and edit your Salesforce data when you are offline? Although we are surrounded by internet connectivity most of the time, we are constantly on-the-go and having access to important data, even without internet access, is a great advantage. So how does offline view and edit access actually work? Offline access is possible when caching and Offline Edit is enabled for users…. Read More

Offline access to your Salesforce data

Focus on People: Jordan Elkin

Jordan Elkin is a Technical Consultant. He always knew that Technology Consulting was going to be his field, but he was on the look out for how to get started. Soon enough, he learned of the existence of Salesforce, and wanting to get to know it, watched some of the online sessions from Dreamforce 2015. He developed his Salesforce skills over the next few months, received his certifications, and now works… Read More

Focus on People: Jordan Elkin

Delivering successful Salesforce projects using Agile

Aymeric Zito is the CEO of ProQuest Consulting. In this article, he discusses how ProQuest have been so successful using the Agile project methodology to deliver Salesforce projects. Before we learn more about how Proquest uses Agile, can you tell us about your background and how you got started with Salesforce? My background is in neuroscience and software engineering. I started my career programming enterprise web applications in Java J2E and moved… Read More

Delivering successful Salesforce projects using Agile

Focus on People: Alex Bassett

Alex Bassett is a Salesforce Consultant based in Vancouver, Canada. Alex was originally working as a Data Reporting & Information Analyst, but upon learning about Salesforce and its opportunities, decided to begin his climb to get certified. After receiving his Certified Salesforce Administration designation in June 2016, he quickly found a job as a Salesforce Consultant. Learn about Alex’s Salesforce journey below. How and Why did you get started with Salesforce?… Read More

Focus on People: Alex Bassett

Apex Best Practices – Avoid Exceeding Governor Limits

Apex Code is the Force.com programming language used by developers to build custom business logic on the platform by writing Apex Triggers, custom VisualForce controllers and extensions, Anonymous Apex codes, etc. It runs in a multi-tenant environment where a single resource can be shared by all different Salesforce organisations or instances. In this case, it is crucial to ensure that no organisation would monopolise the resources. Salesforce.com enforced a set… Read More

Apex Best Practices – Avoid Exceeding Governor Limits

Salesforce Lead Process

Salesforce is a CRM or Customer Relationship Management tool and as such, its primary use is to manage the relationship between a business and their customers. Prior to consumers or businesses becoming customers, however they start out as potential leads. In this post are the basics of how to utilize Salesforce to track leads, convert them to deals and best practice around when to do so.All businesses are unique so… Read More

Salesforce Lead Process

Focus on People: Nick Liechty

Nick Liechty is a next-generation innovative Salesforce leader with a unique combination of technical expertise and enterprise experience across a variety of industries. Having architected and led dozens of clients through their journey into the Salesforce ecosystem, he is definately one of the leaders of the pack. Below he shares some of his experiences and tips with you: How and Why did you get started with Salesforce? I was doing… Read More

Focus on People: Nick Liechty

Extending Social Sign-On in Communities

By: Warren Mangahas With an ever-expanding number of social media platforms, the need for companies to accommodate third-party logins is increasingly paramount. Even if you have a fantastic Salesforce Community set up, full of valuable resources and a vibrant user-base, the idea of having to sign up on another site and memorize another password may just be enough to turn someone off from signing up. This is where Salesforce Social Sign-On… Read More

Extending Social Sign-On in Communities

Customizing a Flow User Interface

Flows are a very useful way for developers to create standardize business processes and perform actions in Salesforce, without writing any code. Some examples of where Flows can be useful include helping your Customer Service team provided consistent service across your organization by standardizing questions and scripts, or Flows can be used internally to help maintain data integrity. When you embed your Flow into your user’s UI, you will usually… Read More

Customizing a Flow User Interface

Focus on People: Nancy Johnson

Nancy Johnson is a high level Project Manager hailing from Sydney, Australia. Having focused on being a Project Manager and Business Analyst during her career, getting Salesforce certified was her next logical step. Nancy shares her Salesforce journey with us below. How and Why did you get started with Salesforce? I am a very experienced Project Manager and a friend asked me to be a Project Manager at her organization… Read More

Focus on People: Nancy Johnson

Top 5 Salesforce Business Analyst Skills

Salesforce Administrators are in the unique position of wearing numerous hats to maintain their instance. Depending on the number of licenses and integrations, people can find themselves in more of a business analyst or project manager position instead of working in just Salesforce. Quite a few admins are the sole system experts for their company so this can be very complicated when enhancements pop-up. The main problem is that just… Read More

Top 5 Salesforce Business Analyst Skills