Newer Version Available
Subscribe to Platform Event Messages with Flows
- (Optional) Specify conditions that determine whether to pause a flow interview.
- Select the platform event that the flow interview subscribes to.
- Identify the values that a received event message must have to resume the flow interview.
- (Optional) Create a record variable in the flow to store the data from the event message that resumes the flow interview.
Example
This pause element is set up to resume a flow interview when a vendor response event message is received (1). The order number in the event message must match the flow’s {!orderNumber} variable value, and the order status must be Shipped (2). When the flow interview resumes, the {!vendorResponse} record variable is populated with the data from the event message (3).
If flow interviews and active processes are subscribed to the same platform event, we can’t guarantee which one processes the event message first.
Flow interviews evaluate platform event messages in the order they’re received. The order of event messages is based on the event replay ID. A flow interview 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. The event messages in a batch can originate from multiple publishers.
Flow interviews resume in a separate Apex transaction than the transaction that published the event message. The flow interview resumes asynchronously under the Automated Process entity. As a result, there can be a delay between when an event message is published and when the interview evaluates the event message. 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 message. System fields, such as CreatedById and LastModifiedById, reference the user who published the event message.