I have the below sample code:
global class BatchApexExample implements Database.Batchable<SObject>{
public Database.QueryLocator start(Database.BatchableContext bc){
System.debug('Number of callouts allowed from Start method is '+ String.valueOf(Limits.getLimitCallouts()));
return Database.getQueryLocator('SELECT Id,Name FROM Lead WHERE LastName = \'Batch Test\'');
}
public void execute(Database.BatchableContext bc, List<SObject> scope){
System.debug('Number of callouts allowed from execute method are '+ String.valueOf(Limits.getLimitCallouts()));
for(SObject obj: scope){
Lead leadObj = (Lead)obj;
leadObj.LastName = 'Batch Test Updated';
update leadObj;
}
}
public void finish(Database.BatchableContext bc){
System.debug('Number of callouts allowed from finish method are '+ String.valueOf(Limits.getLimitCallouts()));
}
}
I am just trying to see how many callouts are allowed from start, execute and finish method.
But this always prints as zero for all the three methods..What is wrong with this code?
Note: I have two leads in database with last name = 'Batch Test'