Newer Version Available
Subscribe to Platform Event Notifications with Flows
To subscribe to event notifications, create a flow that waits for a platform event to occur. In the Wait element, select the event type to wait for and identify the values the event must have for the flow to resume. Optionally, create an sObject variable to store the event’s data when the flow resumes.
Example
The wait event resumes the flow when a vendor response event occurs (1). The event’s order number must match the {!orderNumber} variable value, and the order status must be Shipped (2). When the flow resumes, the {!vendorResponse} sObject variable gets populated with the event’s data (3).
If flow interviews and active processes are subscribed to the same platform event, we can’t guarantee which one processes the event notification first.
Flow interviews evaluate platform event notifications in the order they’re received. The order of events is based on the event replay ID. A flow interview can receive a batch of events at once. The order of events is preserved within each batch. The events in a batch can originate from one or more publishers.
Resumed flow interviews execute in a separate Apex transaction than the transaction that published the event. The flow interview resumes asynchronously under the Automated Process entity. As a result, there can be a delay between when an event is published and when the interview evaluates the event. Automated Process creates the debug logs corresponding to the interview resuming, but the interview’s actions are executed on behalf of the user who published the event. System fields, such as CreatedById and LastModifiedById, reference the user who published the event.