I have a schedule apex class that calls Queueable apex which calls a class that do a callout and then execute batch.
I receive System.AsyncException: Database.executeBatch cannot be called from a batch start, batch execute, or future method.
global class WorkdayGetRequisitionsSch Implements Schedulable, Database.AllowsCallouts{
global void execute(SchedulableContext sc){
System.enqueueJob(new WorkdayGetRequisitionsQueueable());
}
}
public with sharing class WorkdayGetRequisitionsQueueable implements Queueable , Database.AllowsCallouts {
public void execute(QueueableContext context) {
Workday.getRequisitions();
}
}
getRequisitions(){
HttpRequest req = new HttpRequest();
HTTPResponse res = http.send(req);
...
Database.executeBatch(new WorkdayGetRequisitionsBatchJobs(mapStaffingJobs.Values()), 10 );
}