[SalesForce] Explain: Big objects don’t support transactions including both big objects, standard object and custom objects

While reading the Big Object related documentation, I was curious as to what does the following statement mean?

  • Big objects don’t support transactions including both big objects, standard object and custom objects.

Consider the following scenario:

  1. External system pushing records into BigObjects (Platform/Enterprise WSDL)
  2. SOQL to retrieve the records and work off the records to create a custom/standard Sobject record. (Async SOQL not an option because I do not wish to use target sObject to store the retrieved records)
  3. Update the BigObject using the "insertImmediate" method with a status as "Processed"

You can create and update custom big object records in Apex using the insertImmediate method — Reference: Documenation – Page 9 Populate Custom BigObject with Apex

Doesn't the above scenario mean that I would be involved in an Apex transaction with custom Objects as well as the Big Objects?

Best Answer

You are ok to query for Custom/Standard objects but your scenario will not work if you use DML on the Custom/Standard objects followed by an insert on a Big Object unless the Big Object operation is done asynchronously you will get an error. See Database.insertImmediate here. You can insert a Big Object record first and then do DML on a Custom/Standard object but not the opposite direction.

Related Topic