-
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
How Salesforce Training And Certifications Help with Better Career Opportunities for IT Professionals
About: If you're looking for it, then BismilSoft gives you the fine Salesforce education direction in Noida with stay task and certification. The Salesforce education…
How to Use Salesforce for Customer Retention – 5 Effective Tips
Customer retention is the process of retaining customers and preventing them from switching to some other brand with a similar product or service. It plays…
Salesforce Integration with LendFoundry: Fueling the Digital Lending Revolution
Are you still using manual and paper-based processes for managing loan operations? The traditional ways of lending resulted in longer decision times and opacity for…
Popular Salesforce Videos
Salesforce enthusiasts welcomes you to the Trailhead! Skill up for the future.
A trailhead is defined as an outdoor space that is designated by an entity responsible for administering or maintaining a trail to serve as an…
Salesforce Professional Services Helps Customers Get Value From Salesforce, Faster
Our experts have helped thousands of customers transform their businesses, operating models, and cultures, all backed by the full power of Salesforce. Watch this video…
5 Salesforce Developer Interview Red Flags That’ll Likely Get You Rejected
These are some common interview red flags that’ll likely get you rejected for that dream Salesforce developer job. Start prepping accordingly! Watch this video and…