Real-Time Updates

Overview

Platform Events allow your Avonni Dynamic Components (Chat, Kanban, List, Data Table, etc.) to listen for changes happening in your Salesforce org and automatically refresh their data in real-time.

By default, if another user or an automated process updates a record while you are viewing it, you won't see that change until you manually refresh the page. This feature solves that problem, ensuring your users always see the most up-to-date information without interruption.

This guide walks you through the one-time setup required in Salesforce to enable this functionality.

To make real-time updates work, you need three things:

  1. A Platform Event: A "signal" that Salesforce broadcasts when something changes.

  2. A Trigger Flow: An automation that fires the signal when a record is created or updated.

  3. Component Configuration: The Avonni Dynamic Component listening for that signal.


Configuration Walkthrough

To explain the setup, we will use a common scenario: Making a Case Chat update instantly when a new comment is posted.

The goal is to notify the Case Record Page that a change has occurred so the chat can refresh.

1

Create a Platform Event

We need a custom event object to act as our "notification signal."

  1. Go to Setup > Integrations > Platform Events.

  2. Click New Platform Event.

  3. Label: Enter Chat Notification (or Record Change Event).

  4. Plural Label: Chat Notifications.

  5. Publish Behavior: Select Publish After Commit.

  6. Click Save.

Add a Payload Field

We need a field to carry the ID of the record that changed so the component knows which data to refresh.

  1. In the Custom Fields & Relationships section of your new Platform Event, click New.

  2. Select Text as the data type.

  3. Field Label: RecordId.

  4. Length: 18.

  5. Field Name: RecordId (API Name will be RecordId__c).

  6. Click Save.

Note: You can add more fields if you want to pass specific data, but the Record ID is usually sufficient for refreshing components.

2

Create a Trigger Flow

Now we need to tell Salesforce to actually fire this event when a record changes.

  1. Go to Setup > Process Automation > Flows.

  2. Click New Flow and select Record-Triggered Flow.

  3. Configure Start:

    • Object: CaseComment (or the object your component is displaying).

    • Trigger: A record is Created (or Updated).

    • Optimize for: Actions and Related Records.

  4. Add Element: Create Records.

    • Label: Publish Platform Event.

    • Object: Select the Platform Event you created in Step 1 (e.g., Chat Notification).

    • Set Field Values:

      • RecordId__c{!$Record.ParentId}

    • Why ParentId? Since the Chat is displayed on the Case page, we need to notify the Case that something happened. When a Comment is created, we grab its Parent's ID and broadcast that.

  5. Save and Activate the flow.

3

Connect Your Component

Now that the backend is broadcasting signals, you simply need to "tune in" your Avonni Dynamic Component.

  1. Open your component in the Avonni Component Builder.

  2. Ensure the Data Source is set to Query.

  3. Open Advanced Options > Query Refresh EMP.

  4. Fill in the settings:

    • Channel Name: The API name of your event (e.g., Chat_Notification__e).

    • Key Field Name: The API name of the payload field (e.g., RecordId__c).

    • Key Field Value (Optional): Leave blank.

      • Behavior: By leaving this blank, the component automatically compares the event's RecordId with the record currently displayed on the screen ({!RecordId}). If they match, it refreshes.

Result: Your component will now refresh its data automatically whenever the flow from Step 2 runs.


Testing Your Configuration

To verify that real-time updates are working:

  1. Open your Salesforce Record Page in two separate browser tabs (or use an Incognito window for the second one).

  2. In Tab 1, post a new message (or update a record).

  3. Watch Tab 2. The component should update instantly to show the change without you clicking refresh.


Troubleshooting

If the component does not update:

  • Check Permissions: Ensure the user has permission to read/create the Platform Event object.

  • Check API Names: Ensure Channel Name includes the __e suffix and Key Field Name includes __c.

  • Check Flow Debug: Use the Flow Debugger to ensure the Platform Event is actually being published when you create a record.

Last updated

Was this helpful?