I have created one vf page to create a report on what are the open cases available in the particular org as a PDF. I need to use an Apex schedular to send periodic emails with the pdf file as attachment to my client email id.

Can you please any one help me on this?

I have given below the vf page and Apex class which I used for creating report as a PDF.

VF Page:

<apex:pageBlock >

    {!contactName}'s Cases

    <apex:pageBlockTable value="{!cases}" var="c">    

        <apex:column value="{!c.status}"/>

        <apex:column value="{!c.subject}"/>



Apex Class:

public class retrieveCase {

    public String getContactName() {
        return 'Babara Levy';

    public List<Case> getCases() {
        return [SELECT status, subject FROM Case
                WHERE Contact.name = 'Babara Levy' AND status != 'Closed' limit 5];

you'll have to create a VF email template, since you cant use getContentAsPDF in an async context.

have a look into the documentation
Creating Visualforce Email Templates http://na15.salesforce.com/help/doc/en/creating_visualforce_email_templates.htm

Integrating Email with Visualforce http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_and_templates.htm

| improve this answer | |
  • Thanks for the reply I will try these links and update you on the same – Arun Jul 8 '13 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.