function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sumit jaitlySumit jaitly 

Callouts is not allowed at Scheduled Apex

Hi All,

Could you please let me know , how can we run a batch class which are containing callouts, on Scheduled Apex.
when i am running batch process on click event It is working fine but when i scheduled it the it is giving me error like 'callouts is not allowed at Scheduled Apex. '

Regards
Sumit
Thiyagarajan Selvaraj (SFDC Developer)Thiyagarajan Selvaraj (SFDC Developer)
Hi Sumit,

To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition.
 
global class SearchAndReplace implements Database.Batchable<sObject>, 
   Database.AllowsCallouts{
}