-
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
Salesforce Consulting: The Potential of Salesforce Consulting Services
Salesforce Consulting Services is trending due to the fact that they're expanding their support options to a wide variety of customers, meaning they're able to…
Simplifying Salesforce CPQ Migration: A Spotlight on iSyncSF
In the dynamic landscape of modern business, the seamless transition of critical systems like Salesforce CPQ (Configure, Price, Quote) between different Salesforce orgs is paramount.…
Service Cloud in Salesforce - Learn All About it Here!
This area of the Salesforce platform is dedicated to supporting and helping our customers. As a result, customers are happier and more loyal, contributing to…
Popular Salesforce Videos
What are sObjects in Salesforce? | Salesforce Development Tutorials
In this video Shrey not only teaches you sObjects but also demonstrates the use of sObjects in Apex. He explained about the sObjects and how…
24 hours on the salesforce platform
Dreamforce ’18 gave us new ways to talk to Einstein, and new ways to talk about equality with Adam Rippon. We looked at customers from…
Create Custom App in Salesforce | Salesforce Training
Following Pointers are included in this video: 00:00:00 Agenda 00:00:36 What is Cloud Computing? 00:03:12 What is Salesforce? 00:05:21 Benefits of Cloud computing & Salesforce…