This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public without sharing class MultiQueryExampleBatchJob implements Database.Batchable<SObject>, Database.Stateful { | |
private Schema.SObjectType currentSObjectType; | |
// Add any SObject Types here if you want the batch job to query them | |
private List<Schema.SObjectType> sobjectTypes = new List<Schema.SObjectType>{ Schema.Account.SObjectType, Schema.Contact.SObjectType }; | |
public Database.QueryLocator start(Database.BatchableContext context) { | |
this.currentSObjectType = this.sobjectTypes.remove(0); | |
return this.getQueryLocator(); | |
} |