-
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[] { 'cromahead@gmail.com' } );
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
Chrome Extensions for Salesforce - A comprehensive review
Evgeny Azimzhanov works on the team at Aquiva Labs. They build customer-centric cloud apps on several platforms - especially Salesforce. Evgeny shares his experience trying…
Things You Need to Consider While Integrating WordPress and Salesforce
WordPress and Salesforce are no less than a match made in heaven. When you go for a WordPress Salesforce Integration (WordPress website with Salesforce as…
Salesforce CPQ: Key Features Not to Miss
In a previous article, we showed you Salesforce CPQ and its main benefits. You already know that it is a tool specialized in the sales…
Popular Salesforce Videos
Marketing Cloud To Become Customer Company
Leverage Marketing Cloud's ability to engage customers by delivering premium personalized experiences and building meaningful relationships with them. Contact Cyntexa to boost your business with…
5 Pillars of a Successful Salesforce DevOps Process
Looking to improve your release and issue resolution times using Salesforce DevOps methodologies? DevOps is a software development and delivery process enabling seamless collaboration between…
How to Automate Business Processes in Salesforce CRM | Salesforce Flow Explained
Want to streamline your business processes without diving into complex coding? In this video, Kirill, an AQA engineer and certified Process Automation Professional at ENWAY,…