I am looking to assemble an HTML Letterhead Email Template for an email service integration project.
There are two sObjects that hold this information - EmailTemplate
and BrandTemplate
.
BrandTemplate.value
= broken HTML (styles aren't associated to tags) Letterhead with CDATA tags throughout to hold the email Template info
EmailTemplate.HTMLValue
= User-created HTML email template
I've been trying to merge the two (don't need to worry about merge fields / codes) with little success.
I have tried turning both into XML, navigating the BrandTemplate.value field, but Salesforce does not natively support CDATA. I've also tried the polar opposite - stripping everything into text and doing replaces and substrings to assemble, but that also fails.
My end goal is to have a completed single HTML document consisting of both the BrandTemplate and EmailTemplate values.
Any hints / thoughts / clues?