-
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

Different Types of Object Relationships in Salesforce
In Salesforce, we can associate one object with another object. We can create the relationship by creating a custom relationship field of an object. By…

Hello World Code for Salesforce Einstein
As a programmer, We do code in many languages. We create always a program named as Hello World. This blog is all about for Hello…

7 Essential Salesforce Hacks For Beginners
Salesforce CRM is an incredibly powerful tool for sales and customer relations. Through Salesforce you can manage customer details and sales prospects as well as…
Popular Salesforce Videos
Password Protect Records in Salesforce
Suppose Salesforce org record level access is set to Public Read Only and now business want to restrict few records visible to only those users…
How to Deactivate Salesforce Users
In this video, we'll show you how to Deactivate Salesforce Users. In Salesforce, you cannot delete users outright, as other references to the user may…
Salesforce - Sage ERP Integration
Salesforce Integration with Sage ERP (SageX3 / Sage100 / Sage300) delivers seamless, real-time, bi-directional integration that plays a pivotal role in unlocking the potential of…