Newer Version Available

This content describes an older version of this product. View Latest

Subscribe to Platform Event Notifications with Processes

Use processes to subscribe to events. You can receive event notifications in processes regardless of how they were published—through Apex, APIs, flows, or other processes. Processes provide an autosubscription mechanism.

To subscribe to event notifications, create a process that starts when a platform event occurs. In the process’s trigger, associate the process with a platform event type and an object type.

Example

This process starts when a Printer Status event occurs. When it starts, the process looks for an Asset record whose serial number matches the event notification’s serial number. Sample process trigger

If flow interviews and active processes are subscribed to the same platform event, we can’t guarantee which one processes the event notification first.

A process evaluates platform event notifications in the order they’re received. The order of events is based on the event replay ID. A process 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.

Unlike record change processes, event processes don’t execute in the same Apex transaction as whatever published the event. The process runs asynchronously under the Automated Process entity. As a result, there can be a delay between when an event is published and when the process evaluates the event. Automated Process creates the debug logs corresponding to the process execution, but the actions are performed on behalf of the user who published the event. System fields, such as CreatedById and LastModifiedById, reference the user who published the event.

Event processes and record change processes have similar limitations. For example, they’re both subject to Apex governor limits.