How to Use Reactive Screen Actions in Flow

How to Use Reactive Screen Actions in Flow

Salesforce introduced the Action Button component in the Summer '24 release. This game changing feature allows you to run autolaunched flows directly from flow screens. However, you have to click a button, which may not be ideal for some use cases. Starting with the Spring '25 release, you can configure Screen Actions to run autolaunched flows without needing to click a button.

Here is how to use reactive screen actions in flow.

Reactive Screen Actions in Flow

Let's build a Screen Flow that lets the user choose an Account record and then displays the related Opportunity records.

1- Create an autolaunched flow that returns the related Opportunity records of an Account.

AccountID text variable is marked as input and OpportunityRecords record collection variable is marked as output. This means that this autolaunched flow receives the Id of an Account record and returns a collection of Opportunity records.

2- Create a Screen Flow, add a Screen element and add a selection component to choose an Account record. For instance, let's use the Lookup component.

Account Lookup

3- Screen Action feature is not a separate screen component but a part of the Screen element itself. Go to the Screen Properties and add a new Screen Action.

Add a Screen Action

Choose the autolaunched flow that you created and set the Id of the Account as an input.

Screen Action Configuration

Since Screen Action is reactive, it will run the autolaunched flow whenever the input value is changed. Therefore, whenever you choose an Account record from the lookup, it will run the autolaunched flow.

4- We want to display the output of the autolaunched flow. Let's add a Data Table component to display the output (Opportunity records).

Data Table to Display the Output

As you can see, whenever you choose an Account, it runs the autolaunched flow and displays the related Opportunity records.

Screen Actions Demo

Screen Actions are not limited to one. You can add multiple Screen Actions to the same screen. For instance, here is an additional Screen Action that summarizes the selected Opportunity records.

Multiple Screen Actions
Summarize Selected Opportunities

What Else Can Be Done?

Reactive Screen Actions are not limited to getting records. Since you are calling an autolaunched flow, you can almost do anything that you need. From creating/updating records to making HTTP callouts.

For instance, in the example below, whenever the question field is changed, the Screen Action automatically runs an autolaunched flow that makes a callout to ChatGPT and returns the answer.

Screen Action with HTTP Callout

Let's see another example related to the file upload component. The standard File Upload component in Screen Flow doesn't have an indication that shows if you uploaded a file. This might be confusing and may cause uploading the same file multiple times. Here is a workaround that you can build using the Screen Action feature. When you upload a file, it retrieves the files and displays them in a Data Table.

File Upload Workaround

The potential use cases for the Screen Action feature are truly limitless!

5 Comments

  1. In file Upload scenario, how are you showing the image. I tried to fetch ContentVersion records & aligned VersionDataUrl field for DataTable>FilePreview column but it is only showing the url.

    • I created a formula field on the Content Version object.

      IMAGE("https://sftime2-dev-ed.file.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId="&Id, "File", -1, 200)

      Because it is just a developer edition and I won't deploy to another environment, I kept the url a bit hardcoded, but I recommend you to make it dynamic.

  2. This feature is absolutely awesome 😀
    Thank you for yet another incredible post Yumi!

    I was always hoping for a functionality displaying the images fast and smooth, just as you showed at the end. Hopefully one day you can show us how you achieved it?

    Have you used LatestPublishedVersion.VersionDataUrl field, as input into a Formula field? Or some other method?
    Best wishes from one of your students 🙂

    • Hi Laura,
      Thanks for the good words!
      The autolaunched flow (launched by screen action) returns a collection of Content Versions.
      I created a formula field on the Content Version object for the preview and used it in my data table.

      Formula:

      IMAGE("https://sftime2-dev-ed.file.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId="&Id, "File", -1, 200)

      Because it is just a developer edition and I won't deploy to another environment, I kept the url a bit hardcoded, but I recommend you to make it dynamic.

      You can read this post to see how to make the link dynamic.

      https://salesforcetime.com/2022/09/13/how-to-create-a-record-link-in-flow/

Leave a Reply

Your email address will not be published.


*