-
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
Shrink Billing Cycles and Automate Invoices with DemandBlue’s Salesforce Billing Implementation
A simplified billing process elevates the buying experience, makes customers feel comfortable, and often turns them into repeat customers. At DemandBlue, our end-to-end Salesforce Billing…
Salesforce Duplicate Management Became Easier
Peeklogic Smart Duplicate Manager. Salesforce Duplicate Management Became Easier Peeklogic helps to provide configure, modernize, and customize solutions for the Salesforce business. Peeklogic uses development…
Salesforce Winter ’19 Release — Key Points
Three times per year, Salesforce release a new version of their products with a range of new features. These versions are named to reflect the…
Popular Salesforce Videos
Google Gantt Chart with Colorful Bars in Salesforce Lightning
In this video, you will learn to implement the Gantt Chart with colorful bars in your Salesforce org. We will use Google Gantt Chart scripts…
New Product: RepBlaze on Salesforce AppExchange
Visit on AppExchange: Click Here As a Sales manager, if you deal with 1000’s of inbound and other leads everyday and would love to automate…
Agile in Salesforce | Agile Salesforce Implementation
Watch this video to learn about Agile Salesforce Implementation When Salesforce met Agile Agile vs Waterfall Introduction to Scrum Scrum Roles Scrum Ceremonies Q&A