Print this page

Why doesn't our email template merge the fields from a related list?

Knowledge Article Number 000003303

The problem here is that related child information cannot be pulled into an email template. Multiple records can be in that related list and the system can't tell what record you want it to pull into the email template, it's also not possible for the email template to pull ALL of the records. In order to pull information into an email template there must be a lookup field to that record, much like Contacts lookup to Accounts. The system sees one single record named in that lookup field and pulls that information down.


In the end there's not a lot that can be done in this situation, other than to work around the standard Salesforce functionality for a one to many relationship situation.

One possibility would be to have a developer create you an Apex Class which will pull all of the related list records into a Visual Force template. The recipient of a Visualforce email would need to be able to login to your Salesforce to view that template, making this resolution less scalable. You could try posting on the message boards at to locate assistance with this matter.

Another possibility is to try to change the process and create lookups to the custom object instead of, or in addition to, using the related list. You will need one lookup for each custom object record you want to pull into the email template. This is not advisable if there will be many records, for instance, if you expect that a contact could have 20 or more orders you would have to create that many custom lookup fields. EG. Order 1, Order 2, Order 3, etc.

If you will have many "orders" related to your Contact, but will only want to merge one or two orders at a time. You could create one or two lookups and reference the Orders related list to decide which orders you want to populate the lookups with, then change the value in the lookup based upon your needs at the time.
You will then modify your email template(s) so that it pulls information for the different order lookups.

promote demote