+ Start a Discussion
Pal2011Pal2011 

Email template in batch apex

Hi,

 

How do I create batch apeax with visualforce page as an email template?

 

Thanks,

sambasamba

1.  PageReference.getContentAsPDF. This method can't be used in: Triggers and Scheduled Apex and Batch jobs and Test Methods and Apex email services.

2.  If your page is a simple VF. You can try this: http://corycowgill.blogspot.ch/2012/02/generating-pdf-in-apex-trigger.html

3.  Batch --> call a test emal and this email is a email template with Visualforce. And this email template includs a component. after then call a PageReference.getContentAsPDF method in component class.

4. You can also use a web service. 

 

Hope this helps.

 

Thanks,

Samba