4 Flows Every Salesforce Admin Needs to Know
4 Flows Every Salesforce Admin Needs to Know

4 Flows Every Salesforce Admin Needs to Know

01/14/2022 by Blake Mahaffey
A closer look at the steps behind the four flows we think every Admin needs to know.

I am a huge fan of all things automation, and if you are reading a post on a cloud computing blog then you probably already know that automation is incorporated into everyone’s daily life.  

Whether it’s as simple as setting an alarm to go off in the weekday mornings, or something more complex, like the reduction of end-user labor to increase time spent on more valuable tasks — automation is here and it’s here to stay.

And in terms of Salesforce’s Flow Builder, there is never a better time to learn than right now. Many or all of you may already be aware that Workflow Rules and Process Builders are due to be sunsetted in 2023 to make Flow Builder the primary declarative automation solution in the Salesforce ecosystem. 

So if you are reading this now, you are already taking the right steps to make sure your org is prepared for the change. If you’ve found this post in the future and the change has happened — welcome! There may still be more to learn.

In our Lunch & Learn, “4 Flows Every Admin Needs to Know,” we demonstrated several flows that were not overly complex — but their use cases are common in general Salesforce administration. In this post, I’m going to walk through the flows we built. This post will be best used as a tool to work alongside the recording.

The full video is embedded at the end of the post, and can also be popped out into a new window to look at along the way.

All the flows demonstrated were built in a Trailhead playground on Sales Cloud. Some of the specific outcomes demonstrated by these flows might be covered through configuration options presented in other Clouds, but the demonstration of how these outcomes are configured should still be useful and applicable in many different use cases. These flows are to be built in Lightning. 

4 Flows Every Salesforce Admin Needs to Know

These are our suggestions for several simple flows to get started with if you are new. These are great flows to practice building and have in your toolkit. 

  1. Updating Records in Flow
    Use case: Standardizing opportunity names

  2. Criteria Based Flows and Actions
    Use Case: An outside inbox wants to be notified when an opportunity of a specific record type is created.

  3. Delete Related Child Records with an Action
    Use Case: Sales reps are spending too much time deleting opportunity line items (products) line by line. Can we have a way to clean them up faster?

  4. Use Screen Flows to Collect Information

    1. Use case: Entry wizard that collects customer feedback and is launched from the screen.
First: Know the Anatomy of a Flow

Before we dive into looking at the flows, let’s step back and review some fundamentals. What are flows?

  • Flows are a declarative (i.e. non code) solution to automation
    • Accessed via Setup 
    • Triggered with a button, automatically, when invoked, or on a schedule
    • Created with Elements and Resources

  • Flow Elements represent an action that the flow can execute such as get records, update records, delete records, send emails, etc.
  • Flow Elements use Resources to help determine action criteria.  Values can be referenced throughout the flow and these values can reference fields on records and beyond. 

Now let's take a look at the first of the 4 Flows to practice building. 

1. Standardize Opportunity Names 

For this flow, we are going to standardize record names. Standardizing record names is a common practice across instances in all sectors.

Create a Record Trigger Flow, upon creation, before save. This is known as a fast flow. It’s more efficient and should be used if you are writing a flow that is going to update the record that fires the flow.

Now create the formula that we will use to set the record name. To do this, we will navigate to our toolbox, go to the manager, and create a formula resource with a return data type of text.

  • {!$Record.Account.Name} & " " & TEXT({!$Record.Amount}) & " " & TEXT({!$Record.CloseDate})

  • We will now use this resource and a get records element to set the record name global variable. 
2. Depending on Record Type, use Send Email Action

Next, we are going to continue to build onto the first  flow to demonstrate additional capabilities. While this next segment could potentially be a flow on its own, Salesforce’s best practice is to consolidate flows whenever possible, so we’re going to consolidate both actions into a single flow. In this scenario, the company would like a non-Salesforce user to be emailed whenever a record with our Big Deal Record Type is created.  

Since this flow involves using an Action, we need to go ahead and switch the flow type from record triggered to after save flow. 

Now add a Decision Element. We will name it Decision on Record Type. Decision_Record_Type.

We will have two outcomes for this - if the Record Type is Big Deal or not.

To do this, we will use a $Record Global Variable, Look into its Record Type ID, and pull the Developer Name. It’s always better to use the Developer Name rather than the label as Developer Names are consistent between environments. 

Next, we will create an email alert. First we will need to create the body of the email that will be sent. This can be done by creating a resource of the type “Text Template.” We can include values from the record that fired the flow by turning once again to our handy record variables. 

We will select the opportunity name, amount, and close date.  Keep in mind this is a small selection of fields, but any field on the record that triggered the flow can be sent to this inbox.

Create a send email core action. For the body, enter the text template. For the subject, we can just write in if needed.

For the sender address, we are going to use the record owner’s email. Watch the Lunch & Learn video to see this in action.

3. Delete Records Using a Screen Flow 

Our sales reps are worried about how much time it takes to delete opportunity line items. Sales are often renegotiated completely in our line of work. This is a common scenario for end users who have to clear out child records in bulk, particularly in something as quick-moving as sales.

The first thing we need to do is create a variable. This variable will store the record ID of the opportunity related to the line items. To do this, we will create a record ID variable. The variable must be formatted in this specific way - with a lowercase r and uppercase I on the ID. This signifies to Salesforce to capture the ID of the record that we are launching this flow from.

Next, we need to grab opportunity line items that are related to this opportunity. We will do that with a get records element. Now, we need to add a potential path in case there are no line items or the flow will fault and throw an ugly error at our user.

Let’s do that with a decision element and tell it that if there are no records found (which we can do by seeing if the resource equals null), to go ahead and let the user know with a new screen. If records are found, we will delete them through a delete action.

Now we don’t want our users to be able to commit this flow without knowing what they are doing - so let’s throw a warning screen up at the beginning of it.

Now we need to create a lightning action to launch this flow and place it on the page layout.

4. Entry Wizard

Our fictional company has a custom object that holds data from surveys that our end-users are encouraged to conduct over the phone with customers after an opportunity has been completed. A screen flow is perfect for this. Although the example we will be building today is brief,  screen flows can use branching logic, integrate with external systems, and are great for walking end-users through standardized data input.

To begin we will start with a screen flow and place a screen element. We will then create dropdown displays with picklist option resources from our custom object to fill in the fields. We will also place some guidance text on the screen flow for users.

After this, we will create a survey record and automatically check the  “Survey completed” checkbox.

Like our previous flow, we need to place this on the screen by creating an action and placing it on the page layout.

Dope Flow Pro Tips

In addition to the steps to build a specific Flow, there are some tips to build Flows in general. In another blog post, I will cover 3 tips to build flows more in-depth.

Here are recommendations to get started with:

    • Always build and test Flows in a Sandbox first.
    • Be careful not to automate your mistakes faster!
    • Standardize your Flow naming conventions using best practices and organizational standards. (Document!)
    • Try to consolidate flows when possible to limit the amount per object. 
    • Optimize and revisit Flows frequently to prevent technical debt.

Watch the full Lunch & Learn above. You can click the title at the top of the video to pop this out into a new window and follow along with these instructions as you watch it there.

Have you built any of these Flows? What Flow skills would you like to learn? Reach out to me on LinkedIn.