[SalesForce] in Visualforce Email Template

Does anyone know any workaround for using <apex:pageBlock> and it's child tags in a VF Email Template?

The error that I'm getting is :

Error: <messaging:emailTemplate> cannot contain <apex:pageBlock>.

There are lots of references to these type of tags in the template and it'll be good if there is an easy workaround so I don't spend 2 days modifying the whole template by hand 🙂

Much appreciated!

Best Answer

You can't use visualforce components that rely on salesforce css in email templates as those css files are not included with the email when it is sent out.

I would recommend replacing all the pageblock, pageblockbutton, and pageblocksection components with outputpanels as those will come closest to mimicing the layout of pageblocks.

Pageblocktables can be replaced with datatables.

Related Topic