Tuesday, January 25, 2011

Email Template Bug in Salesforce

Well to start with, it is no end-user bug. But, after all we developers/consultants are also end users for Salesforce.

It is a bug which can make your email template useless and non-editable (up to some extent).

Following are the steps to recreate it:-
1. Create a visualforce page with contentType = "pdf/excel", lets name the page as "testReport"
2. Create a visualforce email template and place the following code in the template (remove unnecessary spaces in code, have inserted to get data escaped)

< messaging:htmlEmailBody >
< apex:include  pageName="testReport" />
< / messaging:htmlEmailBody >

3. Click on save button.

BINGO.. you would notice that a download window pops up/ file gets downloaded (depends on your browser). You can save the file and view the contents. Its nothing but the email template edit page, in excel :).

Well, now if you go to Setup> Personal Setup> Email> My Templates. Try to View/Edit your email template and you would realize that it just downloads the document as xls :). Off course you can delete the email template.

If you want to edit it, you would have to download it in Eclipse and edit it in there, at least till the time Salesforce fixes this issue.

Popular Posts