-
Salesforce Error : Callout from scheduled Apex not supported.
Hi ,
I am using apex code to send a report as an attachment and schedule it but in Scheduling i am getting this error
"Scheduler: failed to execute scheduled job: jobId: 7012D00000IDppK, class: common.apex.async.AsyncApexJobObject, reason: Callout from scheduled Apex not supported."
here is my code:
global class Exporter implements System.Schedulable {
global void execute(SchedulableContext sc) {
ApexPages.PageReference report = new ApexPages.PageReference('/00O41000001kkjC?csv=1');
Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
attachment.setFileName('scheduledreport.csv');
attachment.setBody(report.getContent());
attachment.setContentType('text/csv');
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
message.setSubject(' Test Client list Report');
message.setPlainTextBody('The report is attached.PFA');
message.setToAddresses( new String[] { '[email protected]' } );
Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );}
}
Now i am not getting that where i am using Callout services. How to resolve this?Thanks in advance!
Rahul Kumar
Log In to reply.
Popular Salesforce Blogs

Outsourcing Strategic CRM Support: A Case for Salesforce Service Cloud Consultant
In today's dynamic business landscape, customer relationship management (CRM) plays a pivotal role in the success of any organization. As businesses strive to build lasting…

What is Batch Apex in Salesforce? A Definitive Guide
Batch classes in Salesforce are used to run large jobs (think thousands or millions of records!) that exceed typical processing limits. Batch Apex allows you…
Popular Salesforce Videos
How To Land A Salesforce Job In India
This video explained about to land a Salesforce job in India. This is a great opportunity to enter the Salesforce echo systems for non-Salesforce professionals…
Lightning Flow – Release Readiness LIVE, Summer '20 | Salesforce
Watch this amazing video & join the Product Managers to see how you can build flows and processes more efficiently with enhancements to Flow Builder,…
Salesforce Development Tutorial - sObjects
It is very easy to learn Salesforce with the world class training tutorial. Training is key for the right knowledge. Those who work as an…