Reader small image

You're reading from  Salesforce for Beginners - Second Edition

Product typeBook
Published inOct 2022
PublisherPackt
ISBN-139781803239101
Edition2nd Edition
Concepts
Right arrow
Authors (2):
Sharif Shaalan
Sharif Shaalan
author image
Sharif Shaalan

Sharif Shaalan was first introduced to Salesforce as an end user in 2007. His range of experience, from a sales rep to technical architect, helped him successfully lead more than 100 implementations including projects that were showcased on the main stage at Dreamforce. In 2013, Sharif was chosen as a Salesforce MVP, and in 2020 he was inducted into the Salesforce MVP Hall of Fame. Sharif is a regular speaker at Salesforce conferences and has obtained more than 10 Salesforce certifications. He is the founder and CEO of Agile Cloud Consulting and continues to be an active Salesforce community contributor
Read more about Sharif Shaalan

Timothy Royer
Timothy Royer
author image
Timothy Royer

Timothy Royer is the VP of Delivery at Agile Cloud Consulting and a Salesforce Certified Application Architect. Timothy began his Salesforce career in 2012 as an accidental administrator and has since participated in a number of implementations in a variety of roles. Timothy has experience as a Salesforce customer, a Salesforce partner, and as a member of the Salesforce.org professional services team.
Read more about Timothy Royer

View More author details
Right arrow

Salesforce Flow

Salesforce Flow is a powerful tool that allows administrators to create automations and guided business processes without having to write code. You can build these powerful automations using a canvas called Flow Builder.

In this chapter we will cover:

  • Introducing flow types
  • Understanding Flow Builder elements
  • Testing a flow
  • An example of a screen flow
  • An example of a record-triggered flow
  • Basic best practices

We are just scratching the surface of what is possible with this tool. Flows are the future of admin-built automation, and while Salesforce previously had two other automation tools, called Workflows and Process Builder, they will be phased out over the coming years.

Salesforce Flow is an important and powerful tool for any Salesforce administrator, so you can expect this chapter to take some more time to complete. Have patience and take breaks as you work through it.

Technical requirements

For this chapter, log in to your development org and follow along with the screenshots provided. When we reach the two example flows in this chapter, it is important that you follow along and build your own flow; this will significantly help familiarize yourself with the process.

What is a flow?

Flows are automations that can be built without having to write code. They consist of series of steps, with branching decision logic, where you can define when and what you want a system to do. Below, you can see an example of a flow that we will build later in this chapter:

Diagram  Description automatically generated

Figure 16.1: Example of a flow

As you can see from Figure 16.1, this flow contains steps for an input screen, a decision that splits down two pathways, and an action that is performed before completing. We can also see that the flow consists of various elements, such as Decision, Assignment, and Create Records. These are categories from which we pick the steps a flow will follow – see more about this in Understanding Flow Builder elements.

There are several different flow types that can be used for different requirements. Salesforce will ask you to pick a flow type before you begin building a flow, so let’s go through these now.

Introducing flow types

To begin creating a flow, navigate to Flows on the Setup page, and click New Flow. When you go to create a new flow, you will be prompted to select from several types, as shown in the following screenshot:

Graphical user interface, text, application  Description automatically generated

Figure 16.2: New Flow screen displaying several flow types

Each type has its own purpose and may fit different business processes or use cases better. In this chapter, we will show an example of a screen flow and a record-triggered flow, which are the two simplest types that have immediate applicability.

Screen flow

This flow type allows you to display screens to an end user to collect or show information. You can incorporate automations and database modifications within this type of flow. This flow type can be placed on Lightning pages, Experience Cloud pages, or launched from a button. An example would be if you want to quickly allow a user to enter a new account and opportunity on one screen from the Lightning utility bar. We will walk...

Understanding Flow Builder elements

After you select your flow type, you will be taken to the Flow Builder canvas where you can add elements by clicking the “+” symbol. Flow elements are all the items you can place within a flow that have different purposes. They represent the “steps” of a flow. As you can see in the following screenshot, they are organized into three main categories:

Graphical user interface, application  Description automatically generated

Figure 16.3: Elements pane on the Flow Builder page

In this section, we will go through each of these categories in turn:

  • Interaction elements are ways that a flow can interact with users or other automations in Salesforce, including Apex classes and other flows.
  • Logic elements are used to design the path of your flow. These elements are where you will have your business logic to determine what screens users see and what data gets updated.
  • Data elements are what we use to make changes to Salesforce data.

We will also cover flow...

Testing a flow

When building a flow you can use the Debug functionality on the Flow Builder to test your flow. This will show you details of how your flow is executed and if any errors are encountered:

Diagram  Description automatically generated

Figure 16.4: Debug button on the Flow Builder page

It will be easier to understand this when we use it on a flow that we have built together, so we will see this in action in the Testing the flow sections as we step through some examples.

A quick note on flow testing: you should always build your flows in a sandbox or developer org and test them thoroughly before deploying to production. Flows are an extremely powerful tool that can wreak havoc if used incorrectly and not tested.

In the summer ‘22 release, Salesforce announced Flow Tests (in beta), which are point-and-click tests that you can construct in order to test flows in a similar way to developers testing Apex code. This will likely become the best practice over time.

Now that we have...

Example 1: screen flow

For both examples, log in to your developer org.

We will build a screen flow that allows a user to quickly enter a basic account and opportunity from one screen.

Business use case

Sales users have been complaining that it takes them too many clicks to enter a new account and associated opportunity. They want to be able to search for an existing account or create a new account and opportunity on one screen, regardless of what tab they are on in the Sales app. To do this, we will create a screen flow and make it accessible from the utility bar.

Building the flow

  1. In Setup, navigate to Flows and click on New Flow:
Graphical user interface, application  Description automatically generated

Figure 16.5: Navigating to the New Flow screen from the Setup page

  1. On the next screen, select Screen Flow and then click Create:
    Graphical user interface, application, Word  Description automatically generated

    Figure 16.6: Selecting a flow type and creating the flow

    We are now in the Flow Builder and ready to create our flow.

  1. Click the “...

Example 2: record-triggered flow

We will build a record-triggered flow to create different tasks for a user based on account type.

Business use case

Account managers are very busy. They would like to automatically have tasks generated for them when a new account is created. This task should be for them to onboard customers and partners.

Customer accounts should have an onboarding process that includes the user who created the account doing the following actions:

  1. Sending a “welcome” email, due one week after account entry
  2. Following up with a phone call, one week after the welcome email

Meanwhile, partner accounts should have an onboarding process that includes the user sending a “partner agreement” email within one week of account entry.

For now, we will just generate tasks for the user who entered the account, but if we wanted to enhance the process even further, we could send those emails out automatically using...

Best practices and more

We just covered the very basics of Salesforce Flow. It is an incredibly powerful tool and should be used carefully. There are tons of great blogs, Trailheads, and learning materials out there for you to develop your skills further. Here are some basic best practices (there are more best practices once you become familiar with loops, record collections, and other advanced topics):

  • Be descriptive: Put descriptions in all your flow elements. It will help you and others when you have to go back to make updates or troubleshoot. Just as a developer should put comments in their code, a flow builder should use robust descriptions.
  • Naming conventions: Use naming conventions for your flow resources. It makes it easier to navigate a flow and understand what is happening. The conventions used do not matter much, as long as you are consistent. Here is an example of a naming convention for flow resources:
    • Variable: var[name] (varAccountId was an...

Summary

In this chapter we have uncovered one of the most exciting concepts in Salesforce, Salesforce flows. Beginning with an introduction to flows, we have progressed into learning the different flow types in Salesforce, and then the elements used in the Flow Builder. After introducing the Debug tool, we have dived deep into two examples: screen flows and record-triggered flows. For each use case, we have learned how to build, test, and distribute the flow. Finally, we have covered the best practices when building flows, as well as pointing to the vast amount of advanced concepts beyond this book.

In the next chapter, we will continue learning how to automate in Salesforce by turning our attention to approval processes.

Questions

  1. What are the different types of flows and what do they do?
  2. What are flow elements? What are the three categories of flow elements?
  3. When would you want to use a screen flow versus a record-triggered flow?
  4. After you build a screen flow, where can you surface it to users?
  5. Why is it important to build flows in a sandbox or developer environment, and not production?
  6. What are the different ways you can test a flow?
  7. Why is it important to include descriptions in your flow elements?

Further reading

Join our community on Discord

Join our community’s Discord space for discussions with the authors and other readers: https://packt.link/rlptF

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Salesforce for Beginners - Second Edition
Published in: Oct 2022Publisher: PacktISBN-13: 9781803239101
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (2)

author image
Sharif Shaalan

Sharif Shaalan was first introduced to Salesforce as an end user in 2007. His range of experience, from a sales rep to technical architect, helped him successfully lead more than 100 implementations including projects that were showcased on the main stage at Dreamforce. In 2013, Sharif was chosen as a Salesforce MVP, and in 2020 he was inducted into the Salesforce MVP Hall of Fame. Sharif is a regular speaker at Salesforce conferences and has obtained more than 10 Salesforce certifications. He is the founder and CEO of Agile Cloud Consulting and continues to be an active Salesforce community contributor
Read more about Sharif Shaalan

author image
Timothy Royer

Timothy Royer is the VP of Delivery at Agile Cloud Consulting and a Salesforce Certified Application Architect. Timothy began his Salesforce career in 2012 as an accidental administrator and has since participated in a number of implementations in a variety of roles. Timothy has experience as a Salesforce customer, a Salesforce partner, and as a member of the Salesforce.org professional services team.
Read more about Timothy Royer