Configuration tutorial
Build a Self-Updating Data Table in Salesforce
This tutorial teaches you how to create a Salesforce data table that magically refreshes itself whenever related records are changed or created. No more manual page refreshes are needed - new updates appear instantly, right before your eyes!
We'll use Platform Events, a Trigger Flow, and a Screen Flow to make this happen.
1. Create a Platform Event
We need a way to signal when a record changes. Platform Events act like a message system, letting us broadcast these changes in real-time
Go to
Setup
and search forPlatform Events
.Click
New Platform Event
.Fill in the
Label
(e.g., "RecordChangeEvent"),Plural Label
, and theAPI Name
should auto-populate.Set Publish Behavior to
Publish After Commit
.Click
Save
.
2. Add a Field to the Platform Event
We'll include a field in our Platform Event to store the ID of the record that was changed. This helps us target updates to the correct row in our datatable later on
After saving, click
New Field
within the Platform Event.Choose a suitable data type (e.g.,
Text
for record IDs).Fill in the
Field Label
(e.g., "RecordId") and theField Name
should auto-populate.Click
Next
, set any required properties, and clickSave
.This field will help filter updates to specific records if needed.
3. Create a Trigger Flow
This flow will automatically run whenever a record is created or updated. Its job is to send a Platform Event message when a change occurs. If needed, we can also add conditions to send messages only for specific changes.
Go to
Setup
and search forFlows
.Click
New Flow
and chooseRecord-Triggered Flow
.Configure the trigger:
Object
: Select the object you want to monitor (e.g.,Lead
).Trigger
: Choose whether it should trigger onCreate or Update
.Condition Requirements
: Define any specific conditions for triggering the flow.
Add a
Create Records
element:Label
: Give it a suitable name (e.g., "Create Record Change Event").Create a Record
: ChooseManually
for How to set record field valuesObject
: Select the Platform Event object you created (e.g.,RecordChangeEvent__e
).Field Values
: Set the fields to reflect the changes (e.g., setrecordId
to{!Record.Id}
).
(Optional) Add a Decision Node:
If you only want to create the Platform Event under certain conditions, add a
Decision
element before theCreate Records
element.Define your decision criteria.
Activate the flow by clicking
Activate
.
4. Create a Screen Flow
This is where we'll build the user interface with our live-updating datatable. The datatable will be configured to listen for the Platform Events we created earlier, so it can refresh itself automatically when it receives a message.
Go to
Setup
and search forFlows
.Click
New Flow
and chooseScreen Flow
.Add a
Screen
element to the canvas.Add a
Data Table
component to the screen.Configure the Data Table:
Data Source
: Set it toQuery
.Object
: Choose the object to display (e.g.,Account
).
Go to
Advanced Options
:In
Query Refresh Emp
, specify the name of your Platform Event (e.g.,RecordChangeEvent__e
).
Save and activate the flow.
5. Deploy the Flow
Finally, we need to make our Screen Flow accessible to users. We can embed it in a Lightning page, an App Page, or even add it to the Utility Bar for easy access.
Now you have a datatable that updates in real-time whenever the specified records are changed, thanks to the power of Platform Events and Salesforce Flows.
Last updated