I need to update an email template which is initially created as a Custom (without using Letterhead) email template to a HTML (using Letterhead) email template. The reason for this modification is , I need to make editable the email template once user going to send an email. Is that possible to do this?
One option we can think that you create the email template as a HTML template and refer the letterhead values from a custom settings where the user will have access . whenever he want to specify the value he can change those custom settings value to get the desired values.
I think you might be able to get away with it by updating the metadata directly (*.email and *.email-meta.xml files) using your favourite IDE, say Eclipse. I haven't tested it but it seems that just by looking at the appropriate values for HTML and custom for the meta.xml files and then 'converting' the email component, it could work. I suggest getting an example for each type, compare the formats and then 'convert'. Hope this helps.
At the same time that Francis A. made his suggestion, I was working on the same solution (great minds... ;-). And I have actually tested it, I now know how to do this.
It is possible to get the sources of email templates in Eclipse. I had to manipulate the package.xml file to get this done, but normally this should work out of the box.
The source of an HTML mail looks like this:
<table border="0" cellpadding="5" width="800" cellspacing="5" height="400" > <tr valign="top" height="400" > <td tEditID="c1r1" style=" background-color:#FFFFFF; color:#000000; bEditID:r3st1; bLabel:main; font-size:12pt; font-family:arial;" aEditID="c1r1" locked="0" > <![CDATA[<p style=...</p>]]></td> </tr> </table>
By substituting the
<p style=...</p> with the HTML code of the custom email template, you have done most of the work. Except that you need to convert
<style> tags into inline CSS.
The resulting email almost looks like the custom email, except for the left and right margins. I googled for this a lot, but no-one seems to know how to get rid of those margins. They are especially annoying when you use the MS Outlook client: then the email appears to be too narrow, but if you print it, it turns out to be too wide. Thank you Microsoft.
Anyway, I now have an email template that looks for 95% the way I want it to, and it is editable by the users after selection. For me it is good enough!
There's no way to change template's type once created.
Because Custom (without using Letterhead) templates and HTML (using Letterhead) templates are different in SF implementation(metadata structure) even these two templates are storing in separate objects in salesforce (EmailTemplate and BrandTemplate ).
So you can't change Custom (without using Letterhead) email template to an HTML (using Letterhead) email template. You will need to create the new HTML (using Letterhead) template and reframe/move your HTML elements to the new template.