+ Start a Discussion
Anil Bolisetty 2Anil Bolisetty 2 

Can we use apex batch jobs on big objects ?

We need to load initilal load on big object ,can we use batch apex if not any other solutions ?
Raj VakatiRaj Vakati
You can leverage Batch Apex with Big Objects to copy the data from the tasks and create an archived record in a Big Object.


You can insert the below code in execute method i guess
// Define the record.
PhoneBook__b pb = new PhoneBook__b();
pb.FirstName__c = 'John';
pb.LastName__c = 'Smith';
pb.Address__c = '1 Market St';
pb.PhoneNumber__c = '555-1212';
database.insertImmediate(pb);
// A single record will be created in the big object.



but If you are trying to use Database.getQueryLocator method in a Batch class.  it is throwing an 'Internal Salesforce Error' on the queryLocator line.


So you should use Iterator instead (with all its limits).