function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VasantVasant 

Error in inserting records in Big objects via Apex

I have used Database.insertImmediate(objOppSplitHistories); method to insert/update records into OppSplitHistories (my custom big object).
Here I have used the above method in apex class and called that method from oppsplit trigger to pass the old map/new map info for saving opp splits changes. But that is throwing the below error. I have observed if I run the same piece of code in ‘Execute Anonymous Window’ then data is  being inserted in to custom big object but despite using insertImmediate method it is not working through trigger.

Error: Update failed. First exception on row 0 with id 049c0000002JaopAAC; first error: UNKNOWN_EXCEPTION, EXTERNAL_OBJECT_UNSUPPORTED_EXCEPTION: Apex triggers can't reference the Big Object BigObjectCounter: []

It seems we cannot populate any bigobject through trigger . Can you please confirm whether my understanding is correct or not.
If it is correct then what should be our approach to populate this big object? Any help will be much appreciated. 
Abdul KhatriAbdul Khatri
You are right trigger is not supported. Please read below under Consideration Heading

https://developer.salesforce.com/docs/atlas.en-us.bigobjects.meta/bigobjects/big_object.htm
VasantVasant
Hi Abdul, The considerations only says that we cannot write Triggers on Big object but it does not say that we should not call the InsertImmediate method from a Trigger (on a Custom object). Its not clear. Whom shall we contact to get this cleared? 
Abdul KhatriAbdul Khatri
The considerations also says the following

Big objects don’t support transactions that include big objects, standard objects, and custom objects.

This link also explains the ways to Populated Big Object

https://trailhead.salesforce.com/modules/big_objects/units/big_objects_define_custom_big_objects
Satish PrajapatSatish Prajapat
Hello Experts,
I same issue with me
I have big object, and i am inserting data from the batch class into big object. when I run test it give me error :
"Internal Salesforce Error: 1347441463-30 (-83575418) (-83575418)"
When I insert data from anonymous console than it inserted successfully, but test is failed.
Satish PrajapatSatish Prajapat
Hell All,
We can avoid this error but cant resolve.
procedure:
Write the code into if condition.
if( !Test.isRunningTest() )
{
         //Your Code
}

You can bypass the error appearing into the salesforce.

Thanks,
satish Kumar prajapat.
Resample AdminResample Admin
I just came across this and worked around it by kicking the Big Object insertion to an @future method.