The “Update Screen” Flow Action Component
Flow Action Components, also known as Local Actions, are a new Flow enhancement in pilot as part of the Spring ’18 release. They’re discussed more here.
This Component works in Lightning Experience.
We created the Update Screen component to address a small but annoying problem some of our customers were having as they integrate flows into their work. They would run a flow from a Quick Action button, and the flow would change the value of a field that was already on the screen. The screen wouldn’t know that the field had changed because the change is done in the cloud and the data on screen has already been downloaded.
Tack this Update Screen action on the end of that flow, though, and the screen will instantly update, and do so without a full page refresh.
The component, like other Flow Action Components and Flow Screen Components is available for installation from our component repository. The installation process may be intimidating to non-developers but you do not actually need to know anything about development to install this component. If you can copy and paste and follow directions, you can install UpdateScreen into your org. And once it’s installed, it will always thereafter be available in the Cloud Flow Designer palette to be added to flows.
How Does It Work?
For those who want to look beneath the hood, UpdateScreen is actually an extremely simple component. It makes use of the Force:RecordData component produced by the Salesforce Platform team:
Here’s where the magic happens:
When the flow engine reaches a Flow Action Component it calls that component’s invoke method. In this case, UpdateScreen then calls upon the force:recordData component to reload the record, which causes the smart Lightning caching logic to refresh the correct record.
Working with Related Lists
Each Update Screen action can currently only trigger refresh for a single object. So a single Update Screen is not able, for example ,to refresh a parent object and several related actions at the same time. But there’s nothing preventing you would putting an Update Screen in a loop that iterates over Related List records, or stringing multiple Update Screens together.
Here’s an example:
This Contact has several related Credit Accounts:
The flow in the upper right closes Accounts, changing their status. You want the ones that are closed to be refreshed in the Related List in the lower left.
To accomplish this, the Flow loops over the changed Credit Accounts:
Each time, the UpdateScreen is passed the current element from the collection of changed items:
If necessary, a separate Update Screen can be used to update the parent object.
Using Update Screen as a Screen Component
You don’t have to be in the Local Actions pilot to try this out, though. You can also create a Flow Screen Component that does this, and insert it into one of your flow screens. That could make sense if your flow had a screen that you wanted the user to go to after the data was changed on the server. To learn more about creating Flow Screen Components, see the release notes.