The Screen Element: Salesforce Flow Builder 101

Last weeks Salesforce Flow lesson started with the introduction of the Decision Element. This week we add to our repertoire with the Screen Element - a hugely customisable template that allows you to collect and show information during the flow. But first a recap - Salesforce Flows are the future of automation in the Salesforce Platform. I’ve previously spoken about what the current automation landscape looks like, and Salesforce has been transparent about the future deprecation of Workflow Rules and Process Builder. This is the second in the series where we talk about how to use various Salesforce Flow elements.

We’ll start with our example business case.

The VP of Sales at Company, Inc has found that Inbound Sales Reps are not capturing all the amount of information required when a new lead calls in. The VP wants a standardised call script made, and some changes made to the Lead object to create a better customer experience on first contact. They’ve also requested a custom button to be added to the Sales lightning app so that the Inbound Sales Rep can launch the script easily.They’ve asked you to make the call script, and add the follow fields to the lead object:

  • An “Initial Questions” field for some text to be added if the lead has any specific questions that need to be followed up.

  • A “Preferred Contact Method” field, with the option to select either text message, email, or phone contact.

  • A “Follow Up Date” field if the lead has a specific time they want to be contacted next.

Step One is creating the required fields on the Lead object.

For our purposes a long text field for the “Initial Questions”, a picklist field for the “Preferred Contact Method”, and a Date/Time field for the “Follow Up Date”.

Thankfully we can use a Salesforce Flow for our required use case - creating a Call Script and capturing the required fields in one go and automating the process of lead creation with the captured information.

We’ll start with the finished flow and work backwards about how we got there.

Here’s a video of the flow in action:

From our business requirements (and the title of this blog post) you can probably guess that we are creating a Screen Flow. Head to the setup menu, search for flow and we will get started.

We’ll start by adding a Screen Element to our flow.

For this flow we’ll choose to hide the header - because our Inbound Reps don’t need to know what the Flow is called. In the footer we’ll choose to hide the previous button on the first screen, and hide the pause button throughout the flow. While not being used in this flow it is worth knowing that with screen flows you can pause and start them again without losing data in-between.

Once the first screen is added save the flow. This makes it easier to save moving forward as you add elements. Now that we have a blank canvas we can start adding pieces to it. On the left hand side of the Screen element we have the components tab - we have options to add input fields (to collect data), or display fields (for formatting). With any flow element we need to add a label and API name. I kept this simple here with Screen One as the label.

Per our Business Requirements we need a Call Script and there’s a few ways to do this.

Display Text (top), Call Script (bottom)

The Screen Element has a Call Script field you can add plain text or a text template (more on this later) to. Alternatively, you can also add a Display Text element - the formatting for both is different but this really becomes personal preference as both are functional.

As far as showing the script there are multiple ways to input the text to the example Call Script field. You can add the text for the field directly, or alternatively can make a Text Template per Call Script field. I chose the second option so that I could create all the Text Templates at the start and add them into each screen as I was building them.

When creating a text template you can include resources such as global variables. For example instead of:

“Thank you for calling Company, Inc. My name is _______. May I start with your name?”

You can insert the User name record so that the flow will automatically show the name of the user running it in this space.

Once you’ve figured out your script and made text templates - piecing together the screen flow is simple. Add the required Call Script fields, followed by the input fields. In this example flow I split this over two screens to minimise scrolling and leader to a better user experience. For each field you add to the screen, choose a API name (I use the format ScreenNumber_FieldDescription) and set any default values as required.

Here's our first screen:

And here’s the second:

The downside to using text templates for the Call Script fields as you may have noticed is that it doesn’t show the script when editing the flow.

Debugging the Flow at this stage should show your script and input fields progressing nicely.

We’ve captured the information but aren’t saving it. As such the next step in the flow is to create a record.

Add the Create Record element to the canvas. Choose a Label and API name. In our example we will only be creating one record at a time, and we want to use seperate resources to set the Record Fields. Select the object for the Flow (Lead). Once selected add the field on the Lead object and match it to API name of the input fields you’ve previously made. It should look something like this.

Debug the Flow and enter in test data. Once the flow is complete look at the Debugging breakdown of what the record creation looks like and ensure all fields are mapped accurately.

If everything passes activate the flow! Once activated we’ve almost done - our last step is to add a button to launch the flow. This can only be done in Lightning apps! This is done in the app manager. Press edit on the Lightning app of your choice, and add a Flow utility item.

Once added open up the Lightning App from the previous step and down the bottom left corner you’ll have an option to run that flow.

Congratulations Admin! With your Flow working and tested you can send it safely to your production Org.

See you on the Trail.

Previous
Previous

Schedule-Triggered Flows: Salesforce Flow Builder 101

Next
Next

The Decision Element: Salesforce Flow Builder 101