function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mustafa TopMustafa Top 

How to send content of SF report with email using schedulable apex class?

getContent() method of PageReference is not working with schedulable class? Therefore I am not sending content of report with email.

 

I have tried with a trigger, is as follows:

 

1- A field be update when the schedulable class is triggered.

2- Update-Trigger works and calls a @future method that contains getContent method.

 

But this is not working. Attached report content can not be seen in the mail. Is there a work-around to this?

Vinita_SFDCVinita_SFDC

Hello,

 

As per design you can't use the getContent and getContentAsPDFPageReference methods in scheduled Apex or in asynchronous calls. There are couple of ideas posted on ideaexchange portal for having this functionality in future release, please vote them:

 

https://success.salesforce.com/ideaSearch?keywords=getcontent

Mustafa TopMustafa Top
Is there another way to get reports content? Such as with soql or web service?
Vinita_SFDCVinita_SFDC

Hello,

 

A workaround could be instead of getting the contents from reports write a query on the obejct on which report is running and write all the fields and filters similar to the report. I am afraid that this might hit the governor limits.

Mustafa TopMustafa Top

Unfortunately the report object does not contain similar of content, contentOfExcel, contentOfText fields.

cplusplus_pleasecplusplus_please
you can create one?



=============================
Developer for www.voicent.com
Voicent provides CRM, auto dialer, predictive dialer, reminder, and call center solution that is suitable for anyone in any level
Voicent strives to meet customer demands to integrate Voicent software with CRM of their choice.