Overview:
An Email Fragment uses token {{ObjectAPIName.FieldAPIName}} which points to a Formula(Text) field containing a HYPERLINK() function.
Example:
Test_URL__c = HYPERLINK(Test_Link_Field__c,'Click Here'), where
- Test_URL__c is referenced in the token and
- Test_Link_Field__c is a URL field.
The token is used in the Email Fragment in the following way:
<a href="{{ObjectAPIName.Test_URL__c}}" target="_blank" style=...> Join </a>
When previewing the Email Fragment within an Email Template online or in the received email, the content is malformed and messed up.
Root Cause:
The <a> tag hyperlinks the hyperlink which confuses the syntax.
Solution:
Do not use double-hyperlinking in the HTML code. There are possible workarounds.
Workaround 1:
- Use the URL field within the <a> tag:
<a href="{{ObjectAPIName.Test_Link_Field__c}}" target="_blank" style=...> Join </a>
Workaround 2:
- Use other tags that the <a> for the hyperlinked field such as <p>:
<p>{{ObjectAPIName.Test_URL__c}}</p>
Note: Workaround 1 is officially not supported, see further the Related Documentation.
Related Documentation:
CRM Online Help Documentation: Approved Email Configuration Tokens