You need to sign in to do that
Don't have an account?
Stéphane CLARET
HTML tags "<" converted in ">" when merging fields in visualforce email template
You can try with a very simple formula field with just IMAGE() like:
Contact.Avatar__c = "IMAGE("http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg", "SCL")"
and create a Visualforce Email Template with:
<messaging:emailTemplate subject="Test for merging HTML fields" recipientType="Contact" relatedToType="Contact">
<messaging:htmlEmailBody >
<html>
<br/>
This is when merging the field:<br/>
{!relatedTo.Avatar__c}<br/>
<br/>
This is when puting the HTML code directly in the template code:<br/>
<img src="http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg" alt="SCL" border="0"/>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Merge with any contact and see: the merged field is not interpreted as HTML.
If you look at it in an email, you will see that
<img src="http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg" alt="SCL" border="0"/>
has been replaced by:
<img src="http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg" alt="SCL" border="0"/>
I didn't found any workarounds. I tyied of course <apex:outputText value="{!HTMLENCODE(relatedTo.Avatar__c)}" escape="false"/> with no better results.
I think this is a bug… but Salesforce Support sent me here "to be sure"…
Contact.Avatar__c = "IMAGE("http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg", "SCL")"
and create a Visualforce Email Template with:
<messaging:emailTemplate subject="Test for merging HTML fields" recipientType="Contact" relatedToType="Contact">
<messaging:htmlEmailBody >
<html>
<br/>
This is when merging the field:<br/>
{!relatedTo.Avatar__c}<br/>
<br/>
This is when puting the HTML code directly in the template code:<br/>
<img src="http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg" alt="SCL" border="0"/>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Merge with any contact and see: the merged field is not interpreted as HTML.
If you look at it in an email, you will see that
<img src="http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg" alt="SCL" border="0"/>
has been replaced by:
<img src="http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg" alt="SCL" border="0"/>
I didn't found any workarounds. I tyied of course <apex:outputText value="{!HTMLENCODE(relatedTo.Avatar__c)}" escape="false"/> with no better results.
I think this is a bug… but Salesforce Support sent me here "to be sure"…
What you can do is, create one more formula field(URL__c) with Text Return type and formula "http://fr.pageondemand.com/emailing/signature_pictures/SCL.jpg".
Now edit your Visualforce Email template with below code:
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal
It worked. Thank you for that.
However, I have the exact same problem with Idea.Body and Idea.LastComment.CommentBody. And, I do not see how to use your workaround with these two fields. (I wish I could just turn off HTML field type for Ideas and their comments by once it is enalbed, we can not go back.
Any idea?
Thnaks.
Stéphane
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal
This is the result:
Congratulations!
This is your new Visualforce Email Template.
When versions are created they need to include the pricing.
<div>
When PageOnDemand was opening for business, majority of users was expecting that prices could be imported. It made sens since users were also using an ERP or at least spreadsheets and didn't want to take any chances by keying the price values again in PageOnDemand.</div>
<div>
</div>
<div>
That was 8 years ago and PageOnDemand users are much more various now.</div>
<div>
</div>
<div>
We understand though that some users may prefer to key price values directly in PageOnDemand and therefore would expect to have an easy way to copy prices from a catalog to an other.</div>
<div>
</div>
<div>
We heard you and even more: we are considering to bring to PageOnDemand users a brand new feature to clone catalogs that would include of course the price list copy.</div>
More over, I need it to be HTML and not plainText. I tested it in HTML, this is the result:
Congratulations! This is your new Visualforce Email Template. When versions are created they need to include the pricing. <div> When PageOnDemand was opening for business, majority of users was expecting that prices could be imported. It made sens since users were also using an ERP or at least spreadsheets and didn't want to take any chances by keying the price values again in PageOnDemand.</div> <div> </div> <div> That was 8 years ago and PageOnDemand users are much more various now.</div> <div> </div> <div> We understand though that some users may prefer to key price values directly in PageOnDemand and therefore would expect to have an easy way to copy prices from a catalog to an other.</div> <div> </div> <div> We heard you and even more: we are considering to bring to PageOnDemand users a brand new feature to clone catalogs that would include of course the price list copy.</div>
In the email, this is what we got:
<html>
Congratulations!
This is your new Visualforce Email Template.
When versions are created they need to include the pricing.
<div>
When PageOnDemand was opening for business, majority of users was expecting that prices could be imported. It made sens since users were also using an ERP or at least spreadsheets and didn&#39;t want to take any chances by keying the price values again in PageOnDemand.</div>
<div>
</div>
<div>
That was 8 years ago and PageOnDemand users are much more various now.</div>
<div>
</div>
<div>
We understand though that some users may prefer to key price values directly in PageOnDemand and therefore would expect to have an easy way to copy prices from a catalog to an other.</div>
<div>
</div>
<div>
We heard you and even more: we are considering to bring to PageOnDemand users a brand new feature to clone catalogs that would include of course the price list copy.</div></html>
Thanks,
-Stéphane
Sorry to reopen this matter, did you find any solution to solve this issue ?
Same problem here with < converted when apply merge fields
Thank you
Laurent