Posts

Showing posts with the label subscribe

Salesforce Fact #857 | BatchApexErrorEvent subscribe using LWC

Image
BatchApexErrorEvent can be subscribed in LWC as well. For this, we have to import the required functions from lightning/empApi module and the channel name is '/event/BatchApexErrorEvent'. In this example, we have subscribed to the  BatchApexErrorEvent using LWC and showing a toast error message on receiving the error. References:  https://developer.salesforce.com/docs/component-library/bundle/lightning-emp-api/documentation https://salesforce.stackexchange.com/questions/297863/showtoast-from-messagecallback-function-of-empapi Attached are the screenshots.

Salesforce Fact #856 | BatchApexErrorEvent subscribe using flow

BatchApexErrorEvent  is a built in event which is triggered for unhandled exception in batch class. In order to raise platform events from batch apex, we need to implement Database.RaisesPlatformEvents interface. We can subscribe to BatchApexErrorEvents using platform event type triggered flow. Reference:  https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/sforce_api_objects_batchapexerrorevent.htm