Loading

Email template doesn’t merge the fields from a related list

게시 일자: Oct 17, 2023
상세 설명

The problem here is that related child information can’t 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.

Note: Merge-fields of custom fields won't work if the primary object doesn't have a relationship with the secondary object that the custom field is from. 

 

Example: Template on Leads, custom field {!User.Signature__c}

 

To create lookup filters in either Salesforce Classic or Lightning Experience, please review Define Lookup Filters.

솔루션

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. One possibility would be to have a developer create you an Apex Class that will pull all of the related list records into a Visual Force template. The recipient of a Visualforce email must 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 Salesforce Developers 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’ll need one lookup for each custom object record you want to pull into the email template. This solution isn’t 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, and so on. If you’ll 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’ll then modify your email template(s) so that it pulls information for the different order lookups.

See AlsoCross-object merge fields do not work in email templates

Knowledge 기사 번호

000385019

 
로드 중
Salesforce Help | Article