Get your Salesforce users informed of a completed asynchronous process (@future, queueable, batch...) with a toast notification and refresh pages users are viewing with rollback data if an error occured, all thanks to a platform event.
Only works for Lightning experience on desktop!
To know and understand the purpose of platform events, please review the following Trailhead modules:
Install the unlocked package by clicking one of the following URLs:
Then, follow these configuration steps:
- Go to the Salesforce instance and go to 'Setup' &rightarrow 'Apps' &rightarrow 'App Manager'.
- Edit the Lightning app of your choice and navigate to 'Utility Items' section on the left.
- Add the 'Asynchronous Process Notifier (LWC)' OR the 'Asynchronous Process Notifier (Aura)' utility item. Do not forget to set 'Start automatically'.
IMPORTANT: A Lightning Web Component cannot subscribe to a Platform Event if there is already an Aura component that is subscribing to a Platform Event in the same Lightning Page. It is a known issue. Then, if an existing Aura component in your user interface uses the lightning:empApi component, use the Aura version of the Asynchronous Process Notifier.
- Install the test package:
- Go to a contact and modify its email address.
- Wait at least 5 seconds for the toast notification to display and the contact email address to revert.