Earn a Salesforce AI Certification by IIT + 12-Week Internship Secure Your Spot Today!

Earn a Salesforce AI Certification by IIT + 12-Week Internship Secure Your Spot Today!
Salesforce Flow Formulas That Are Commonly Used

Salesforce Flow Formulas That Are Commonly Used

Understanding and utilizing formulas within Salesforce Flow can significantly enhance your automation capabilities. This blog post will guide you through some of the most commonly used and helpful formulas, providing you with the knowledge to create more dynamic and efficient Flows.

In this blog, we will guide you through some of the most commonly used formulas in Salesforce flows, such as:

  • Text Operators and Functions
  • Logical Functions
  • Number Functions 
  • Date and Time Functions 

But let’s first understand what formulas in Salesforce flows mean.

What is formula flow?

A formula in Salesforce Flows refers to an expression that performs dynamic calculations or evaluations during the flow’s execution. These formulas can manipulate data, perform complex logic, and handle date and number conversions, much like formulas in a spreadsheet application but within the Salesforce automation framework.

For example, a formula in a flow could be used to calculate a discount on a sales opportunity, determine if a customer is eligible for a special offer, or create a custom greeting for an email based on the time of day. These formulas enhance the capabilities of Salesforce Flows, enabling more personalized and efficient automation solutions.

Online Bootcamps India

Commonly Used Formulas in Salesforce Flows

A. Text Operators and Functions:

Text operators and functions are essential for manipulating and evaluating string values in Salesforce flows. Here are the common useful ones:

1. Concatenation (& / +): This is used to join two or more strings together. It’s particularly useful when you need to combine fields or add text around a field value.

Example:

{!Account.Name} & ” – ” & {!Account.BillingCity}

This formula would result in a string like “Acme Corporation – San Francisco” if the Account Name is “Acme Corporation” and the Billing City is “San Francisco”.

2. TEXT() Function: Converts picklist values or other non-text field types to text. This is crucial when you want to compare a picklist value to a string or include it in a text template.

Example:

TEXT({!Opportunity.StageName})

This would convert the StageName picklist value of an Opportunity to text so it can be concatenated with other strings or used in comparisons.

3. ISPICKVAL() Function: Similar to TEXT(), but specifically designed for picklist fields, allowing you to check if a picklist field equals a certain string value.

Example:

ISPICKVAL({!Opportunity.StageName}, “Closed Won”)

This returns true if the StageName of the Opportunity is “Closed Won”.

4. BR() Function: Inserts a line break in text templates, which is useful for formatting output in emails or rich text fields.

Example:

“Dear ” & {!Contact.FirstName} & “,” & BR() & “Thank you for your business.”

This would create a two-line greeting in an email template.

5. SUBSTITUTE() Function: Replaces occurrences of a specified string within another string with a different string. It’s handy for updating or cleaning data.

Example:

SUBSTITUTE({!Contact.Phone}, “-“, “”)

This would remove dashes from a phone number.

6. TRIM() Function: Removes all spaces from the beginning and end of a string. This is particularly useful when you want to ensure that there are no leading or trailing spaces in user input.

Example:

TRIM({!Lead.Company})

This would trim any extra spaces from the beginning and end of the Lead’s Company name.

7. LEN() Function: Returns the number of characters in a string, which can be used to validate the length of input.

Example:

LEN({!Account.Name})

This would give the length of the Account Name.

8. FIND() Function: Searches for a substring within a string and returns the position of the substring.

Example:

FIND(“Inc”, {!Account.Name})

This would return the position of the substring “Inc” within the Account Name.

9. LEFT(), RIGHT(), MID() Functions: These functions are used to extract specific parts of a string from the beginning (LEFT()), end (RIGHT()), or any specified position (MID()).

Examples:

– LEFT({!Contact.Email}, FIND(“@”, {!Contact.Email}) – 1)

This would return the part of the email address before the “@” symbol.

– RIGHT({!Contact.Email}, LEN({!Contact.Email}) – FIND(“@”, {!Contact.Email}))

This would return the domain part of the email address after the “@” symbol.

– MID({!Account.Name}, 2, 5)

This would return 5 characters from the Account Name starting at the second character.

By mastering these text operators and functions, you can significantly enhance the data handling capabilities of your Salesforce Flows.

Also Read – Salesforce Flow Formulas: How To Use It in Conditions & Actions

B. Logical Functions:

Logical functions in Salesforce Flow are used to perform operations based on boolean logic. These functions are critical for making decisions within your flows based on certain conditions or criteria.

1. IF() Function: This function evaluates a condition and returns one value if the condition istrue and another value if it is false.

Example:

IF({!Opportunity.Amount} > 100000, “Large Deal”, “Small Deal”)

This formula checks if the Opportunity Amount is greater than 100,000. If it is, it returns “Large Deal”; otherwise, it returns “Small Deal”.

2. CASE() Function: This function assesses an expression and delivers an outcome corresponding to the initial match found. It serves as a more streamlined substitute for multiple nested IF statements when there’s a need to consider several conditions.

Example:

CASE({!Account.Industry},

     “Technology”, “Tech”,

     “Healthcare”, “Health”,

     “Finance”, “Fin”,

     “Other”)

This formula returns “Tech” if the Industry is Technology, “Health” if Healthcare, “Fin” if Finance, and “Other” for all other industries.

3. ISBLANK() Function: Determines whether a field is empty or not and returns a boolean value (true or false).

Example:

ISBLANK({!Contact.Email})

This formula returns true if the Email field on a Contact record is empty.

4. BLANKVALUE() Function: This function provides a default value for a field if it is blank.

Example:

BLANKVALUE({!Contact.Phone}, “No Phone Number Provided”)

If the Contact’s Phone field is blank, this formula returns “No Phone Number Provided”.

5. AND() Function: Returns true if all conditions within the function are true.

Example:

AND({!Opportunity.Amount} > 50000, {!Opportunity.IsClosed} = false)

This formula returns true only if the Opportunity Amount is greater than 50,000 and the Opportunity is not closed.

6. OR() Function: Returns true if any of the conditions within the function are true.

Example:

OR({!Contact.Email} = “info@example.com”, {!Contact.Phone} = “123-456-7890”)

This formula returns true if the Contact’s Email is “info@example.com” or the Phone is “123-456-7890”.

7. NOT() Function: Returns the opposite of a boolean value — true becomes false, and false becomes true.

Example:

NOT({!Opportunity.IsClosed})

If the Opportunity is open (IsClosed is false), this formula returns true.

Using these logical functions, you can create complex decision-making processes within your Salesforce Flows, allowing for more sophisticated and nuanced automation rules.

C. Number Functions:

Number functions in Salesforce Flow are designed to handle numerical data, allowing for calculations, conversions, and various operations that involve numeric fields.

1. VALUE() Function: Converts a text string that represents a number to a number type. This is particularly useful when you have numbers stored as text that you need to use in calculations.

Example:

VALUE({!Text_Number_Field__c}) 

If Text_Number_Field__c is a text field that contains ‘123’, this formula will convert it to the numeric value 123.

2. ROUND() Function: Rounds a number to the nearest specified decimal point precision.

Example:

ROUND({!Opportunity.Amount}, 2) 

This would round the Opportunity Amount to two decimal places.

3. FLOOR() Function: Returns the greatest integer that does not exceed the specified number.

Example:

FLOOR({!Opportunity.Discount_Percentage}) 

If Discount_Percentage is 2.9, this formula will return 2.

4. CEILING() Function: Returns the smallest integer greater than or equal to a given number.

Example:

CEILING({!Opportunity.Discount_Percentage}) 

If Discount_Percentage is 2.1, this formula will return 3.

CURRENCYRATE() Function: Retrieves the exchange rate that is defined for a currency in Salesforce for multicurrency organizations.

Example:

CURRENCYRATE(“EUR”) 

This would return the current exchange rate for the Euro currency.

By utilizing these number functions, Salesforce Flow creators can perform various numerical operations to evaluate data within their automated processes.

Also Read – How To Create Formulas in Salesforce Flow?

D. Date and Time Functions:

Date and time functions in Salesforce Flow are crucial for managing and manipulating dates and times, allowing for the scheduling of events, calculations of durations, and setting of deadlines.

1. ADDMONTHS() Function: Adds a specified number of months to a date, which can be positive (to add) or negative (to subtract).

Example:

ADDMONTHS({!Opportunity.CloseDate}, 3) 

This would return a date that is three months after the Opportunity’s Close Date.

2. DATE() Function: Creates a date from year, month, and day components.

Example:

DATE(2023, 12, 31) 

This would return December 31, 2023.

3. YEAR(), MONTH(), DAY() Functions: Extract the year, month, or day from a date, respectively.

Examples:

– YEAR({!Contact.Birthday}) 

This would return the year component of the Contact’s Birthday.

– MONTH({!Contact.Birthday}) 

This would return the month component of the Contact’s Birthday.

– DAY({!Contact.Birthday}) 

This would return the day component of the Contact’s Birthday.

4. WEEKDAY() Function: Returns a number representing the day of the week for a given date, where Sunday is 1, Monday is 2, and so on.

Example:

WEEKDAY({!Opportunity.CloseDate}) 

This would return a number corresponding to the day of the week on which the Opportunity’s Close Date falls.

5. TODAY() Function: Returns the current date.

Example:

TODAY() This would return the current date at the time the formula is evaluated.

6. NOW() Function: Returns the current date and time.

Example:

NOW() 

This would return the current date and time at the moment the formula is evaluated.

These date and time functions are indispensable for any Salesforce Flow that needs to schedule tasks, calculate durations, or perform any operations that are date or time-dependent. 

They provide a robust framework for handling temporal data within your automated processes.

Become a Salesforce Certified Professional

Summing Up

Salesforce Flow formulas, we’ve seen how they can really change the game when it comes to making your work easier. They’re like shortcuts that help you get things done faster and smarter, from sorting out your data to making quick decisions and even keeping track of time and numbers.

But why stop at just knowing about these shortcuts? If you’re the kind of person who loves to keep learning and sharing what you know, our saasguru community on Slack is the place for you. It’s a friendly spot where you can chat with others who are just as into Salesforce as you are.

And if you’re all about getting your hands dirty with real work, our online Salesforce bootcamps are right up your alley. You’ll get to try out everything you learn on actual projects, which means you’ll be more than ready to tackle real-world challenges with your new skills.

Join saasguru today and see how far you can go.

Table of Contents

Subscribe & Get Closer to Your Salesforce Dream Career!

Get tips from accomplished Salesforce professionals delivered directly to your inbox.

Looking for Career Upgrade?

Book a free counselling session with our Course Advisor.

By providing your contact details, you agree to our Terms of use & Privacy Policy

Unlock Your AI -Powered Assistant

Gain Exclusive Access to Your Salesforce Copilot

Related Articles

Mass Assign User Permission Set in Salesforce

Learn how to efficiently mass assign user permission sets in Salesforce using tools like Data Loader. Save time and ensure accuracy. Read now!

How to Clone a FlexCard in Salesforce

Learn how to clone a FlexCard in Salesforce with this step-by-step guide. Simplify customization and boost efficiency effortlessly!

Salesforce Introduces Agentforce 2.0: Redefining How Work Gets Done

Salesforce introduces Agentforce 2.0, the AI platform transforming digital labor with autonomous agents and seamless workflows. Read now!