Automate This! Use Data Fetcher for Reactive Screen Flows.

Automate This! — Use Data Fetcher for Reactive Screen Flows

By

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by #AwesomeAdmin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, see how Josh Dayment dynamically gets records and displays them in a single screen in Flow based off of user interaction using Data Fetcher and reactive formulas for Flow.


Data Fetcher is a free Lightning web component for Screen Flows from the AppExchange that queries records based on an SOQL string. Then, it provides an output of records (or single record) to be used on the same screen, or you can use an aggregate SOQL query to return a number based off of the function you’re doing in your aggregate SOQL.

What’s so special about that, you might ask? Well, let me tell you! With Reactive Components (Beta) for screen flows, you can now have components on a single screen react based on input from other components without ever leaving the screen. This opens up the opportunity to allow your end users to interact with your record queries without having to go back and forth in order to find the right set of records they need to view or interact with.

Let’s take the example I demoed during the Automate This! episode. With Data Fetcher and reactive formulas, I can enable a user to dynamically create an SOQL string and return records into a Data Table without having to click next in my flow—and those records change as the user changes values in the screen! Before getting started, make sure you’ve opted into Reactive Screens (Beta) in the Process Automation Settings page within Setup.

For this flow, I used two picklist components to help build my query utilizing a reactive formula. The user will build out the WHERE clause (they don’t know they are, since it’s happening in a formula 😊). In the first picklist component, the user selects the State they want to search for opportunities in. In the second picklist component, the user selects the Industry for the Account related to the opportunity to return.

Flow screen component with a picklist component showing State choices, a picklist component showing Industry choices, Data Fetcher, and Data Table.

After adding the picklists, I added Data Fetcher to the screen. To set up Data Fetcher, the first thing you need to do is enter the SObject name (that is, object API name) you want to query records for in this flow. I wanted to return Opportunity records, so that’s what I chose. The next two properties are where the magic is really going to happen for Data Fetcher. As part of my requirement, I want to get a summary of all of the opportunities that meet my Billing State and Industry criteria as well as show those records in the Data Table screen component. Data Fetcher lets me do both of those things with the power of SOQL, so I built two formulas to create an SOQL string for my aggregate SOQL query and my regular SOQL query.

Flow screen component with two picklist components, Data Fetcher and Data Table. It also shows the Property Editor for the Data Fetcher component with text bubbles pointing to SObject Name mapped to Object API Name, Aggregate SOQL Query, and SOQL Query.

The two formulas will return a Text data type to pass into Data Fetcher to perform the appropriate SOQL queries.

Flow formula editor showing the aggregateQuery formula.

Here’s the aggregate formula I used that you can copy and use as a template for your own flow.

"SELECT SUM(Amount) FROM Opportunity WHERE Account.BillingState = '" + {!Select_State} + "' AND Account.Industry = '" + {!Select_Industry} + "'"

Flow formula editor showing the queryFormula.

Here’s the query formula I used that you can copy and use as a template for your own flow.

"SELECT SUM(Amount) FROM Opportunity WHERE Account.BillingState = '" + {!Select_State} + "' AND Account.Industry = '" + {!Select_Industry} + "'"

One more formula I needed to create was the label I wanted to show to the end user in my Data Table. I wanted this to change based on the how the user interacted with the picklists as well, showing the State and the Sum Amount of Opportunity Amounts returned from Data Fetcher.

Flow formula editor showing the datatableLabel formula.

Here’s the Data Table Label formula I used that you can copy and use as a template for your own flow.

"Here is a list of Opportunities where the Account is in " + {!Select_State} + " the total value for these opportunities is $" + TEXT({!getOpportunities.aggQueryResult})

Finally, I added the Data Table component to tie everything together and show the opportunities to the end user.

Flow screen component with property editor opened for the Data Table; one text bubble points to the Label where you enter the datatableLabel formula and another points to Source Collection that has the output from the Data Fetcher component.

Note: Choices are not yet reactive as part of the beta but will be reactive in the Winter ’24 Release.

For more information and to install Data Fetcher, visit the AppExchange listing. Learn more about Reactive Screen Components (Beta) on Trailhead!

Resources

Want to see more good stuff? Subscribe to our channel!

SUBSCRIBE TODAY
Leverage flows to process inbound emails with documents

Leverage Flows To Process Inbound Emails With Documents | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, let’s see how Ohad Idan vanquishes shared […]

READ MORE
Improve sales funnel velocity with Flow

Improve Sales Funnel Velocity Using Flow | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, learn how Becka Dente leverages a simple […]

READ MORE
Send a dynamic email to user-defined contacts with flow

Send a Dynamic Email to User-Defined Contacts Using Flow | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, learn how Michael Barnes uses Flow to […]

READ MORE