Find your content:

Search form

You are here

Email Template related record not available


I'm building an email template, and I want to use merge fields from either a Lead or Contact but I also want to use a related record.

I copy the desired merge fields into my template in the web-ui editor, however, when I go to send a test, I select a Contact, but in the drop-down for related records, I don't see the custom object I'm looking for as an available record type to search on. I do see other custom types that I have but don't want to use...?


If I want to build a dynamic URL for a link in the email body with the html editor, and this link is based on some of the merge fields how do I enter them? The html body of the email shows the HTML in the merge fields in the WSIWYG editor for HTML templates. It has a weblink editor - but I'm not sure where to merge the un-encoded email with merge fields, like so...ok I think I found this in the email template in the IDE...!

<a href="{!sObject__c.MergeField__c}">{!sObject.Name}</a>

Attribution to: jordan.baucke

Possible Suggestion/Solution #1

Regarding your 2nd question, please check my blog post titled 'Dynamically populating custom HTML email template content in with custom dynamic data using Apex' which uses custom HTML email templates to send email with data populated from both standard object and dynamically computed data. The code referenced in this article uses SingleEmailMessage to send emails. It can take both email addresses of the recipients or the Salesforce Ids (if it's Salesforce user) which doesn't count against the daily limits.

Attribution to: Tech Matrix

Possible Suggestion/Solution #2

Check the 'Allow Activities' checkbox under the Optional Features section on the custom Object's edit page. If you do not have that checked then the Object won't come up in the Related to Record picklist. I don't recall in which documentation I read that, but I just verified it in my DE. My quick search found this knowledge article.

Attribution to: Peter Knolle
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content