Real time updates shown on record fields without user refresh

I was wondering if there is any way to show a real time update by a callout which fires, let’s say an async method called from a trigger.

Scenario:

User updates something on the account record page and this
fires a trigger that does the callout from Salesforce to a webservice. The update will
be shown when the response is received without needing user to refresh
the page
.

What are the possible ways that this is possible on the platform? Can we use platform events? Streaming API? LWC wire? Change data capture?

Answer

For anyone looking for a similar question, it’s possible with EMPAPI + CDC.

Using a custom component on record page that listens to the record’s channel
handle the change event if the record id matches with the one on the event, then fire refresh view you can check the record id on the event payload.

Documentation

{
    "payload": {
        "recordIds": [
            "<record_ID>"
        ]
    }
}

Attribution
Source : Link , Question Author : Atlas Can , Answer Author : Atlas Can

Leave a Comment