Popular Validation Rules for Salesforce Flows including Phone, Email and Address Fields

Salesforce Flow validation rules are essential for ensuring data accuracy and consistency in automated workflows. By setting specific conditions that data must meet before it is saved or processed within a flow, these rules prevent erroneous or incomplete information from moving forward in the workflow. For instance, you might create a validation rule that requires certain fields, such as phone, email and address, to be filled out or ensures that a value falls within a specified range before the flow can continue. This not only enforces data quality standards but also helps avoid downstream errors that could disrupt business processes or lead to poor decision-making. With flow validation rules, Salesforce admins can maintain control over data integrity while enhancing user experience by proactively catching errors.

Sponsorship Opportunities

Below are a few popular flow validation rules I used in my projects

Name

Standard length for Name Fields is 40 for First Name, 20 for Middle Name and 80 for Last Name.

First Name

Error message:

Your entry needs to be shorter than 40 characters.

Validation rule:

LEN({!First_Name})<=40

Social Security Number (USA)

Error message:

Please enter 9 digits for the SSN field.

Validation rule (this rule allows for dashes):

OR( 

REGEX( {!Social_Security_Number} , "[0-9X\-]{11}"), 

REGEX( {!Social_Security_Number} , "[0-9]{9}") 

) 

Address

Standard length for address fields are 256 for Street Address and 80 for City. The ZIP (Postal) code can be in XXXXX or in XXXXX-XXXX format (USA).

State Code

Error message example:

Please enter a State Code consisting of two capital letters.

Validation rule:

NOT( 

 AND( 

   NOT(ISBLANK({!State})), 

   OR( 

      LEN( {!State}) <> 2, 

      NOT(CONTAINS({!State}, UPPER({!State}))) 

    ) 

 ) 

) 

ZIP (Postal) Code (USA)

Error message example:

ZIP code needs to be in XXXXX or in XXXXX-XXXX format.

Validation rule:

REGEX({!MailingZIP} , "\d{5}(-\d{4})?")

Revenue

Error message example:

Your entry needs to be shorter than 16 digits.

Validation rule (Currency upper limit):

{!Revenue}<10000000000000000

Email

Error message example:

Please enter a valid email address.

Validation rule:

REGEX({!Email_Address},"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}")

Phone number

Error message example:

Please enter a 10 digit phone number.

Validation rule:

AND( 

LEN({!Mobile_Phone})=10, 

NOT(REGEX({!Mobile_Phone} ,"^[a-z A-Z]*$"))) 
 

Incorporating Salesforce Flow validation rules into your automated workflows can be transformative for maintaining data accuracy and enforcing business standards. These rules not only ensure that critical data points like names, social security numbers, and contact information meet required formats but also prevent incomplete or invalid entries from progressing through your system. By using validation rules to define acceptable data criteria, you create a more reliable, error-resistant environment that supports both user confidence and data integrity. 

Explore related content:

6 Things You Can Do With The Transform Element

Top 9 Salesforce Winter 25 Flow Features

Enhance UX in Flow with Custom LWC Icon Selector

Andy Engin Utkan

Andy Engin Utkan is a Salesforce MVP with 24 certifications. He is the founder of Salesforce Consulting Partner BRDPro Consulting. Utkan is a consultant, trainer, and content creator, focusing on automating business processes using Salesforce flow. He is recognized for his expertise in Salesforce flow, providing guidance through various courses and contributing actively to the Salesforce community.

3 Comments

  1. Some great suggestions there Andy. Those with international customers will need different rules for postal codes (may be non-numeric) and state values.

    1. Hello, Daryl, good reminder. We will add a disclaimer here. However, would you like to give us a few more postal code validations from around the world, we can add them here and credit you for your contribution. Another way of doing this is for you to guest-write a part-two post for this. We would love that, as well. Cheers.

Leave a Reply

Back to top button

Discover more from Salesforce Break

Subscribe now to keep reading and get access to the full archive.

Continue reading