Platform Event Triggered Flow

Platform event triggered flow launches when a platform event message is received. This auto-launched flow runs in the background. Similar to objects we can use the platform event field values from the platform event message by referencing the $Record global variable.

Advertisements

How this type of flow can be used? 👇

✾ To handle the error in the screen flow, we can design this kind of flow. Salesforce automatically publishes a platform event called FlowExecutionErrorEvent that notifies subscribers of errors related to screen flow executions.

✾ It can be used to record an error when an exception occurred in the Apex batch class in the custom object OR to send an email to the user. Salesforce publishes a platform event called BatchApexErrorEvent that notifies subscribers of errors and exceptions that occur during the execution of a batch Apex class.

✾ To handle the errors that occur during payment processing (capture, apply, and refund) on an order summary.

✾ You can create a flow to subscribe to your custom platform event, and you can perform all flow actions you want inside of the flow.

Advertisements

This video demonstrates how to create an error log record whenever a screen flow fails.

Platform Events that are Supported

Flows can subscribe to custom platform events and these standard platform events.

  • AIPredictionEvent ↠ Notifies subscribers when an Einstein feature, such as Prediction Builder or Case Classification, has written prediction results back to a target object and AI prediction field.
  • BatchApexErrorEvent ↠ Notifies subscribers of errors and exceptions that occur during the execution of a batch Apex class. 
  • FlowExecutionErrorEvent ↠ Notifies subscribers of errors related to screen flow executions. Messages for this platform event aren’t published for auto-launched flows or processes.
  • API Anomaly Event – Track anomalies in how users make API calls.
  • Credential Stuffing Event ↠ Tracks when a user successfully logs into Salesforce during an identified credential stuffing attack. 
  • Data Object Data Change Event ↠ Notifies subscribers of action within Salesforce CDP.
  • Platform Status Alert Event ↠ Notifies subscribers of alerts that occur during the processing of a user request or service job execution.
  • Process Exception Event ↠ Notifies subscribers of errors that occur during payment processing (capture, apply, and refund) on an order summary. 
  • Report Anomaly Event ↠ Tracks anomalies in how users run or export reports, including unsaved reports.
  • Session Hijacking Event ↠ Tracks when unauthorized users gain ownership of a Salesforce user’s session with a stolen session identifier. 

Flow and Platform Event Considerations

  • Platform event-triggered flows and flow interviews evaluate platform event messages in the order in which they are received. The order of event messages is determined by the event replay ID. A flow can receive a batch of event messages at once, up to a maximum of 2,000 event messages. The order of event messages is preserved within each batch. A batch of event messages can come from multiple publishers.
  • Each platform event-triggered flow or resumed flow interview is executed asynchronously in a transaction distinct from the transaction that published the event message. As a result, there may be a delay between the publication of an event message and the evaluation of the event message by the subscribed flow or interview.
  • Debug logs for platform event-triggered flows and resumed flow interviews are displayed under the Automated Process user. However, each flow interview takes place in the context of the user who published the event message. For example, if a flow interview creates or updates records, system fields such as CreatedById and LastModifiedById refer to the user who published the event message.
Advertisements

Summary

Platform event-triggered flow is a powerful flow type that allows us to play with standard and custom events and define process automation based on the event. I would recommend using it wherever you can and avoiding code solutions.

Join 768 other followers
Advertisements
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s