-
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
Here's How You Can Ease Operations for Your Non-Profit Organization: With a Salesforce Customer Portal
Salesforce's powerful customer portals give you the tools to keep your organization running efficiently and provide your members, donors, and customers with more self-service and…
Salesforce Financial Services Cloud Spring '23 Highlights
Shake off those winter blues with the new features coming in Salesforce's Spring '23 for Financial Services Cloud. Whether it's ARC enhancements, interaction summary automation,…
Salesforce Field Service Lightning | All You Need to Know
FSL is an extension of Salesforce Service Cloud that helps you and your team members, who work outside the office at clients locations, to manage…
Popular Salesforce Videos
Top 5 FAQs' of Salesforce Commerce Cloud
Salesforce Commerce Cloud, formerly known as Demandware, is a user-friendly and streamlined e-Commerce platform designed with a simple goal to help a company expand its…
Introduction to Salesforce Marketing Cloud
Hello Everyone, In this video, by Amit Singh, we will talk about the basic introduction of the Marketing Cloud in Salesforce. Watch the video and…
Introduction to Flow in Salesforce
This informative video on flows in Salesforce contains the following topics:- 00:00 - Introduction 02:14 - Agenda 02:49 - Flow is Automation 03:35 - The…