wand-sparklesReal-Time Data Synchronization

Overview

By default, Salesforce data in your browser remains static until you manually refresh the page. Platform Events transform your Avonni components (Chat, Kanban, List, Data Table, etc.) into "live" interfaces that update instantly whenever changes occur in your Salesforce org.

This eliminates data lag and ensures your team is always working with the most current information without interruption.


The Architecture of Real-Time Updates

To enable this functionality, you need to configure three specific elements:

Requirement
Role
Description
  1. Platform Event

The Signal

A custom "broadcast" channel in Salesforce used to announce data changes.

  1. Trigger Flow

The Broadcaster

A Record-Triggered Flow that sends the signal the moment a record is created or updated.

  1. Component Config

The Listener

The settings within your Avonni component that tell it to "listen" for the signal and refresh automatically.


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?