Error System.CalloutException: Callout from scheduled Apex not supported

i have created a schedulable class which has to trigger a batch job. The run method for the batch class will get list of data to process from a webservice callout. Now, i got the exception below. Any suggestions please.

System.CalloutException: Callout from scheduled Apex not supported.

global class scheduledDeltaBatchable implements Schedulable {
   global void execute(SchedulableContext sc) {
    ID batchprocessid ='Delta'));


If you want to do it in the schedule class you will need to do it in an @future method:

or here on stack exchange:

Scheduled Apex, Callouts and Running a Batch

Why not just perform the callout in your Batch Apex start method? This
means you will always start the Batch Apex job from your Scheduled
apex job, but i think is on balance better than having to marshall
schedule jobs between @future jobs?

if you want to do it within the batch that is ran by the schedule you will need to implement the callout interface

global class scheduledDeltaBatchable implements Schedulable, Database.AllowsCallouts

To use a callout in batch Apex, specify Database.AllowsCallouts in the
class definition

Source : Link , Question Author : Bforce , Answer Author : Community

Leave a Comment