How to subscribe to BatchApexErrorEvent and send notifications in a flow?

BatchApexErrorEvent notifies subscribers (Apex Triggers, Flows, Processes & Streaming API) of errors and exceptions that occur during the execution of a batch Apex class. This blog focusses on subscribing to the error event using no code flow approach.

Prerequisite: The batch Apex class needs to implement Database.RaisesPlatformEvents

Flow

Create a new Flow and select 'Platform Event-Triggered' flow 



Choose 'Batch Apex Error Platform Event' platform event 


{!$Record} variable provides all the relevant information related to the Batch Apex Error which can be used in sending notification.


Start: 

Get Custom Notification Type: 


Assign Notification Recipients (add to a collection):


Send Notification: 

Comments

Popular posts from this blog

How to get CustomNotificationTypeId in flows without hardcoding?

How to Mass Transfer Opportunities using Salesforce Flows

Understanding vCore CPU utilization in MuleSoft CloudHub