Capture Change Events in Apex Triggers (Developer Preview)

With Apex change event triggers, you can now capture and process change events on the Lightning Platform. Change event triggers run asynchronously after the database transaction is completed. Perform resource-intensive business logic asynchronously in the change event trigger and transaction-based logic in the Apex object trigger. By decoupling the processing of changes, change event triggers can help reduce processing times of transactions.


The change event trigger feature is available as a developer preview. The change event trigger feature isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don't implement functionality developed with these commands or tools.

Where: This change applies to Lightning Experience and Salesforce Classic in Developer edition.

How: Each change event captured in the trigger contains the record fields and metadata information about the change in header fields.

Change event triggers are “after insert” triggers and are created in the Developer Console the same way you create an Apex object trigger. When you create a trigger, pick the change event object from the sObject dropdown, which is populated with the change events available in your org. For a supported standard object, the change event name is StandardObjectNameChangeEvent. For a custom object, the change event name is CustomObjectName__ChangeEvent.

In this release, change event triggers don’t support packaging or Apex tests.


The following trigger example shows the skeletal declaration of a change event trigger on AccountChangeEvent.

trigger AccountChangeTrigger on AccountChangeEvent (after insert) {