-
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
The Journey Of Salesforce - Walking Down The Memory Lane
Salesforce is the most popular CRM, connecting businesses and customers in the digital age. Salesforce, which was founded in 1999, enables businesses of all sizes…
Top 5 Feature Updates in Salesforce Spring ‘20 Release
Hello everyone and welcome to 2020! We hope you all enjoyed the holidays and had a nice new year! With a new year brings a…
5 Salesforce Lightning Features You're Missing Out On
Personalities praised for being bold, unique and intuitive deserve a working environment that reflects the same. Salesforce has transitioned from data entry focused on workflow…
Popular Salesforce Videos
Know Why Salesforce Is Secure For Your Business Data
Salesforce.com uses a variety of methods as mentioned in the video - to ensure that your business data is safe, secure, and available only to…
Algoworks is Now a Salesforce Gold Partner
Being just a registered partner back in 2013, the journey to striking Gold in 2020 has been long. On the way to getting that Gold,…
Salesforce Contact Tracing for Employees Demo
As businesses gradually reopen after worldwide closures, many people feel concerned about the second spike in COVID-19 cases. To ensure public safety, local officials have…