When user is using our App and some asynchronous action happens e.g. Batch job finishes - user should be informed about the change of a current data.

Solution

Platform Event Handler LWC component can be used. It displays a Toast message that enables user to refresh our custom LWC components (/wiki/spaces/ECPQ/pages/3069542524) and standard Salesforce layout or ignore it.

Example use case (gif)

Example

Establish communication between backend (enxCPQ__CPQ_EventLWC__e) and frontend (Platform Event Handler):

Frontend - place Platform Event Handler LWC component on your page.

Backend - publish enxCPQ__CPQ_EventLWC__e event:

Database.SaveResult dbResult = EventBus.publish(new enxCPQ__CPQ_EventLWC__e(
    enxCPQ__Event_Type__c = 'REFRESH_PAGE',
    enxCPQ__Source_Id__c = quote.Id
));

if(!dbResult.isSuccess()) {
    // ...
}

Where:

Refer to /wiki/spaces/ECPQ/pages/421855236 for proper implementation.