function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Creating Mailmerge Templates with custom related objects



I'm hoping someone can help me with this because I can't seem to find any real documentation on Mailmerge templates in Salesforce nor can I find any samples.


In the past I've built Mailmerge templates for Opportunities that show all the Line Items for the opportunity.  I have custom objects related to an opportunity and I want to do a Mailmerge template that shows all the child records for an opportunity in a manner similar to Line Items.


I've tried doing this through Word and it returns the Opportunity items but it doesn't return the child object items.  So if anyone's got a sample Word document they'd be happy to pass along or tell me how I can address parent-child relationships in Mailmerge, I'd appreciate it.


Also I'm wondering if I can do a mailmerge for an Opportunity and show Line Items and also show Quotes and also show the records of custom child objects all in the same template.


Thanks in advance!!




This is possible with a Visualforce Email Template.  See this AppExchange listing for an example.


There is an old idea on the IdeaExchange about delivering this natively (link to idea).  You'll see a lot of back and forth between customers and Salesforce re: whether this was really delivered if the only way to do it is with Visualforce. 



The Idea post and your response are regarding email templates, not Mail Merge templates.  Or are you suggesting that instead of a Mail Merge template I actually email myself instead of doing a Mail Merge?


Mail Merge has allowed Opportunity and Opportunity Line Items to happen for many years whereas regular email templates have not.  I want to know how to do the same thing in Mail Merge templates using other objects or custom objecs as what already works for Opportunity and Line Item.


Oops, my brain totally went to email templates.  For more advanced mail merge templates, I recommend Conga Composer, an application on the AppExchange by AppExtremes.  I use it and can pull information from lots of related objects and pull them into my one mail merged document.

Sapana WSapana W

Could me point out to how this can be done. I search in documents of Conga Merge to show parent object record and related child record. But could not find anything which will help in this

I think their configuration guide is the best bet.  See page 13 and it will explain how to use a Salesforce report to get to your data.


It's a matter of creating a report in that shows the data you want and then linking that into Conga.  For example, if you just wanted to show Account information, you would use the Account report type in to create a report and use Conga to pass in the Account ID.  And if you wanted to show both Account and Contact information, you would use the Accounts and Contacts report type in Salesforce to create a report and use Conga to pass in the Account ID.


If you need help after reviewing the configuration guide, I highly recommend contacting them directly for Support.  Their support is pretty amazing and they'll be more than happy to help you out.