I have an existing scheduled callout which returns data that we save in Salesforce. The number of records being returned from the external webservice API is constantly increasing, so I would like to move this to batch.
In order to process the response, I also have to make several SOQL queries to the Salesforce database, and compare the existing Salesforce data to the data returned by the external webservice API.
How can I pass the callout response data, and the results of several SF queries, to the "execute" method of the batch class? In all the examples that I see, it seems that only one list of one object is being passed to the "execute" method. Is that all batch can do?
public Database.QueryLocator start(Database.BatchableContext BC){
Http http = new Http();
...construct callout
HttpResponse response = http.send(request);
Map<String, Object> ResponseMap = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
List<Object> ListOfEnvs = (List<Object>)ResponseMap.get('assets');
Contact [] Cons = [SELECT Email, AccountID FROM Contact WHERE Email != null]
CustomObject [] CustObjs = [SELECT Field1, Field2 FROM CustomObject]
public void execute(Database.BatchableContext BC, ??????????){
for(Object Env : ListOfEnvs){
...
}
for(Contact Con : Cons){
...
}
for(CustomObject CustObj : CustObjs){
...
}
public void finish(Database.BatchableContext BC){
}