-
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
Top 10 Salesforce Admin Tips in 2018
No doubt, you might be the best Admin, but still, you will always look for tips to maintain the spark of being the best. When…
Pardot vs. Marketing Cloud: A Right Choice For Marketing Success
As we wrap up our exploration of Pardot and Marketing Cloud, ask yourself: Which platform best suits your unique marketing needs and objectives? Are you…
Learn All About IDs in Salesforce
Ids in Salesforce Hello everyone, In our previous blog we learned about Salesforce in career growth. In this blog, we are about to find out…
Popular Salesforce Videos
Developing an Automated Salesforce Data Quality Process
Learn how to create a harmonious and automated Salesforce data quality process with easy to customize tools and best practices. Beginning with the identification of…
Public Groups In Salesforce | Salesforce Development Tutorial
Public Groups In Salesforce. In this video, the following points will be covered - 1. Introduction Get a brief introduction about public groups. 2. Purpose…
Avoid Common Security Mistakes in Salesforce
Are you using Salesforce in the most secure way? Security is not a “set it and forget it” thing. We conduct Salesforce Security Risk Assessments…