-
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 MuleSoft Can Help in Streamlining your Back Office Data? | Salesforce Guide
Using disparate applications across an enterprise creates a burden on IT teams. The implementation, maintenance, and monitoring of an increased number of applications and systems…
Agentforce: The Next Salesforce AI Evolution
Businesses are always looking for technologies that might provide them a competitive edge in the fast-paced digital landscape, particularly when it comes to managing sales,…
Connecting to Salesforce with Devart Data Connectivity: A Comprehensive Overview
Salesforce is a cloud-based customer relationship management (CRM) software that provides a wide range of tools and services to help businesses manage their customer interactions…
Popular Salesforce Videos
Salesforce For Beginners - Introduction To Salesforce | Salesforce CRM Developement Tutorials
Contents for this Salesforce Training Video: 1:05 - Index 1:31 - What is CRM ? (Customer Relationship Management) 2:17 - What is Salesforce CRM? 3:18…
Get the Most Out of Your Digital Adoption Efforts On Your Salesforce Community with GuideIn
Navigating online communities can be tricky. GuideIn is a Salesforce-native, lightning-ready product from the house of Grazitti that enables you to maximize digital adoption in…
Salesforce Pardot Basics - A Comprehensive Guide (2021)
In this short video, we will cover the basics of Salesforce Pardot Pardot by Salesforce is a demand generation and marketing management tool by Salesforce.…