Newer Version Available

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

Big Objects Queueable Example

To read or write to a big object using a trigger, process, or flow from a sObject, use asynchronous Apex. This example uses the asynchronous Apex Queueable interface to isolate DML operations on different sObject types to prevent the mixed DML error.
Available in: both Salesforce Classic and Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions for up to 1 million records

Additional record capacity and Async SOQL query available as an add-on license.


Example

This trigger occurs when a case record is inserted. It calls a method to insert a batch of big object records and demonstrates a partial failure case in which some records succeed and some fail. To create metadata files for the Customer_Interaction__b object in this example, use the XML excerpts in the Create Metadata Files for Deployment example.

To add logging to a custom object and surface errors to users, use the addError() method. See An Introduction to Exception Handling.

Tip

The trigger uses the Queueable Apex interface to asynchronously call a method to insert into a big object.