//query
String query = 'Select Name, Id, OwnerId From Account Where ID IN: (Select AccountId From AccountHistory)';
//batch class
SendAccounts sender = new SendAccounts(query)
Database.executeBatch(sender);
//batch class definition
global class SendAccounts implements Database.Batchable<sObject>, Database.AllowCallouts{
global final String Query;
global SendAccounts (String qry){
Query=qry;
}
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<sObject> scope){
//perform logic
//make 1 http callout
}
global void finish(Database.BatchableContext BC){
}
}
1 risposta
Hi,select Accountid, account.name, account.ownerid from AccountHistoryThere is a trick to know if you want that works with the workbench using a new line for each field.Otherwise, the workbench rejects with an error but it is clearly possible. Best regardsAlain