The Summer ‘24 release has been quite significant for Salesforce Flow. If you’re not up to speed on some of the major releases, you can read more about it in my summary of the top 10 Flow features of Summer ‘24. There was one feature that really stood out to me as a powerful enhancement for many Flow artists, and of course, I’m referring to the action buttons.
Adam White announced this new feature a few months prior to the release, and the SF Ben team actually had the opportunity to host a LinkedIn Live on the topic – make sure to give it a watch if you haven’t already!
Business Requirement – The Special Advantage
Let’s introduce a challenge that will be solved using Flow action buttons. You’re the solo admin for a financial management organization that has adopted Salesforce Flow well across all areas of the business – kudos to you! Your business requires a new calculator to be surfaced within Salesforce.
This calculator helps a mortgage broker figure out how likely a customer will be to purchase a certain loan product, but they’ve noticed something quite peculiar. Based on the data that they’ve meticulously gathered in Salesforce (again, kudos!), they’ve learned that the likelihood of a purchase can be impacted by whether it is raining on the day. They’ve requested a calculator that generates the likelihood of a deal closing, taking into account the current weather data in the person’s city.
There’s one final requirement: the business wants all this to be done on a single screen. They don’t like having to click “Next” just to have the weather data pulled – they want simply to be able to make their selections on one page, click “Calculate”, and watch the magic happen on one screen.
After hearing the requirements, you sit back in your chair and wipe the sweat from your brow – this is going to be a challenge! Salesforce has invested heavily in adding reactivity to Screen Flow in recent releases, but what the business is asking for isn’t something you’ve seen before! That is, of course, before you see the LinkedIn Live recording that was mentioned above and learn about the upcoming action buttons for Flow!
How to Configure Flow Action Buttons
Action buttons were introduced in the Summer ‘24 release and are bound to overhaul how many Flow Builders operate. At their core, these are buttons that you can place within a Screen Flow that can perform complex actions behind the scenes and without leaving the current page.
Think of action buttons like you would a subflow – they are actions that occur outside of your Flow that have impacts within it, and you can pass inputs and receive outputs from them. In fact, you can call a subflow from an action button, which is what we’ll do in this example.
Once you’ve selected the subflow that you wish to call with your action button, then you need to configure it to do so. From within a Screen in your Screen Flow, simply drag the Action Button component onto the canvas, set the API Name and Label values, and finally select the Action (subflow) that you wish to call.
Depending on your subflow and your business requirements, you may want to pass in input variables and configure your output variables as well. These outputs can then be used throughout the rest of your Flow, including on the very same Screen that contains the Action Button that called the Flow. This answers the ‘reactive’ part of the business requirement mentioned above.
Armed with this knowledge, you’re ready to design a solution to meet the business requirement that was presented earlier using an Autolaunched Flow with HTTP Callouts, a Screen Flow, and the crown jewel of the Summer ‘24 Flow release – action buttons.
Creating the Autolaunched Flow
First off, you’ll need a way to gather the live feeds from the bank. To do this, you’ll create an Autolaunched Flow that uses an HTTP Callout to your external system. We’ll use Certify CRM’s guide here as this will guide you through a step-by-step process of connecting your Salesforce org to Weatherstack. Complete the guide up to the Create a Screen Flow section, as we’ll be creating a slightly different Flow – an Autolaunched one.
Similar to the Flow in the example, this Autolaunched version will have two main elements: the Call Weather action and an Assign Outputs variable. Before that, however, we need to configure an Input variable as we’re going to receive the City from the parent Screen Flow that we create next. Create a new variable, call it “inputCity”, set the Data Type to “Text”, and ensure it is made available for input.
Now that you’ve done this, you’ll want to configure the Call Weather action similar to the guide mentioned above, except you’ll want to set the query key to the inputCity variable you’ve just created.
Note: When you’re configuring your callout, select “Use Example Response” before providing the example response in the guide. If you have any issues when clicking the Review button, you may need to replace your fancy quotes (“”) with standard ASCII ones (“”) as these can cause issues.
Finally, once the Call Weather action is configured, we need to ensure the Screen Flow has something that it receives back. We need to create another variable, this time for the output. The requirement states that it’s the rain that determines whether or not a customer will buy, so this is what we need to output. Call your new variable “outputRainfall”, make it another Text variable, and this time set available for output to be true.
Next, you’ll need to create a new assignment that will set the value of outputRainfall to be equal to the returned value from Weatherstack. Name your assignment and configure it so that outputRainfall equals {!Call_Weather.2XX.current.precip} (Outputs from Call Weather, 2XX, current, precip).
Brilliant! Don’t forget to save and activate your Autolaunched Flow and give it a logical name (I named mine “AB – Get the Weather”) so that you can start configuring your Screen Flow and Action Button.
Creating the Screen Flow With Action Button
Remember how daunting that business requirement seemed at the beginning and how complex it may become? Would you believe me if I told you that (not counting the Autolaunched Flow) your Screen Flow would be made up of one element? Crazy, right? It is all thanks to the power of action buttons in Flow!
The first step is to create a new Screen Flow and a new Lead variable called “recordId”, as you’re going to want to display this on the Lead page. Make sure this is available for input as well.
Next, you need to add a Screen element. This should be labeled “Calculate Prospect Likelihood”. Then (and I know you’ve been waiting for this part), you’ll need to add an action button to the page. Give your action button a label “AB – Get the Weather” and select the Autolaunched Flow that you built previously as the action. Pass through the recordId.City value as this will be used to determine where the weather data should be queried for.
Note the Output Resources section at the bottom of the Action Button properties panel – the outputRainfall variable that you created in the Autolaunched Flow is automatically pushed out of the action button when it runs. The next step is to display this data in a way that shows the user exactly what they’re looking to know – whether it is raining, and how this impacts the likelihood of a sale.
The Weatherstack API explains that the precip value is the level of precipitation, by default, in millimeters. This basically means that if it is zero, there is no rain currently. If there is any other number greater than zero – it is raining. For the purposes of this demonstration, let’s keep it this simple.
Underneath the Action Button, you need to create two separate Display Text components – one with a positive message, “It’s raining! The likelihood is higher!” and the other with a negative message, “No rain today. The likelihood of sale is lower.”
You only want the correct one to show, so you’ll need to use Component Visibility to ensure that only the correct message is displayed. Both should ensure that the action button successfully gathered results, but the difference should be in the result itself.
For your POSITIVE message, ensure it is only displayed when the following are met AND:
- Get the Weather > IsSuccess equals True
- Get the Weather > Results > outputRainfall does not equal 0
And for your NEGATIVE message, ensure it is only displayed when the following are met AND:
- Get the Weather > IsSuccess equals True
- Get the Weather > Results > outputRainfall equals 0
With that built, it’s time to test it! Save your Flow and run it in Debug. You’ll be prompted to select a Lead record – make sure you select one with the City value set. Click the “Get Weather for Lead” action button, and within a few seconds, you should see one of the two messages displayed. Unfortunately for me, today’s not a great selling day for Bertha Boxer, but the Flow did run successfully and displayed the right message based on the data from Weatherstack.
Once you’ve tested and embedded your Flow into the Lightning page, that’s pretty much it! With a single Screen component, one Action Button, two Display Text components, and the Autolaunched Flow, you are able to help your business determine if today is the best day to try and make the sale to your customers based on the weather. Next week’s tutorial: how to do a rain dance to ensure you make the sale!
… Just kidding!
Summary
Action buttons are going to redefine how users interact with screen flows in real-time. Reactivity has been and continues to be a major focus for the Flow team at Salesforce, and with these action buttons entering the mix, we’re going to feel the life brought into screen flows like never before.
Once again, don’t forget to watch the LinkedIn Live that demonstrates this and other great additions to Flow in Summer ‘24. Additionally, the Flow Features, Treasure Hunt, and release readiness articles will help you master all things Flow and Summer ‘24.
If you’re completely new to screen flows and are looking to learn more, I would love to help you along your journey through the Ultimate Salesforce Flow Foundation course. I’ll guide you through the basics and test your knowledge with a series of projects. Start mastering Salesforce Flow today!