With platform event triggered flows, we can do all our automation in one place. Users can trigger a Flow when a platform event message is received. Also users can access all available records when a Flow is invoked by the platform event message which was not possible through process builders.
What are Platform Events?
Salesforce lets you connect your business processes to external applications by exchanging real-time data using platform events. Platform events are scalable, secure messages that contain data. A publisher publishes events her message that subscribers receive in real time. If you want to change the published data, you need to define platform event fields.
Streaming API uses push technology to publish events and provides a mechanism to subscribe to these events and retrieve data in near real time. Platform Events (PE) is one of Salesforce’s streaming APIs. This follows the fire-and-forget mechanism of integration. Publishers can publish customized payloads and multiple subscribers can get the same PE at the same time by subscribing to that PE. A secure and scalable solution.
What can we do with platform event trigger flow
Let’s take an example where we want to run an business process where a company selling t-shirts and jeans wants to automate a process.
They want to to send an email to the warehouse team when a product is sold to the customer once the warehouse management system calculates and return the estimated time of delivery to salesforce via platform events they want to send an email to the customer with the estimated delivery date.
In this case we can create a flow which triggers when an item is sold and sends an email to the warehouse team. After that we will use the PAUSE element to pause the flow and wait for the platform event to receive the delivery time from the warehouse system.
Considerations for the Flow and Platform Events
We cannot guarantee which one processes each event message first if platform event-triggered flows, paused flow interviews, and processes are all subscribed to the same platform event.
Flow interviews and flows that are triggered by platform events assess platform event messages in the order they are received. The event replay ID determines the order of the event messages. A batch of event messages, up to 2,000 in total, can be received by a flow at once. Within each batch, the order of the event messages is maintained. A batch of event messages may come from different publishers.
Every resumed flow interview or platform event-triggered flow runs asynchronously in a different transaction from the transaction that published the event message. Consequently, there can