-
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[] { '[email protected]' } );
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
Data Modeling in Salesforce - The Basics
Salesforce Data Model is the method to represent the table in your Salesforce org in order to make the data understandable to the viewers. Data…
Salesforce Duplicate Management | The key to cut down the roots of duplicity
Duplicity is the bane of any database. On average, 40- 50% of a company’s data has duplicate copies spread all across the organization. These copies…
FAQs to Understand Salesforce Chatter Better
Salesforce Chatter is a social tool that helps professionals and companies work BETTER. The platform allows you to get brainstorm ideas, share loaded files, sites,…
Popular Salesforce Videos
Basic Concepts of Salesforce | Salesforce Training Online
This video session on Salesforce online training covers the basic concepts of Salesforce and will give intense knowledge on Salesforce at a very high level.…
Set Access for Lightning Knowledge ‐ Set Up Salesforce Knowledge
User permissions control access to different tasks. Using permission sets or custom profiles you can grant Ada the article-related permissions she needs. Create a permission…
Slack API Integration for Salesforce Marketing Cloud
Connect Salesforce Marketing Cloud and Slack the way you want. Watch this video to learn all about Slack API Integration for Salesforce Marketing Cloud. If…