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

Mail merge on custom objects

I am building a application using only custom objects. One of the custom objects is called 'Properties' and holds household address information, which I wish to use to drive a mass mail merge. For example, I may have 200 property records, and I would like to generate PDF informational letters to send to all of them. I don't need to send emails.


At the moment I export the data to a CSV file and do a merge using MS Word on my PC, but I'd like to move this functionality into Salesforce so I can deploy it to a wider group of users and enforce consistent merge templates held in Salesforce.


In Salesforce the functionality I would like to use is 'Mass Mail Merge' but this seems to be limited to the standard Contacts object. Since I'll always be mail merging in bulk (100+ letters) using the individual merge functionality doesn't work either. There doesn't seem to be generic mail merge functionality that is useable within the platform, but this doesn't seem to me to be an unusual use case.


My options seem to be:


1. customise the whole process in Salesforce, using Visualforce templates for each letter template

    - taking this approach means we lose the ability to have users easily amend/rewrite Word templates, extensive ongoing VF template maintenance will be costly

2. use a paid App like Conga Mail Merge or LOOP Merge

    - taking this approach solves most of the problems, but we'd like to trigger these merges from a workflow which is not possible using this approach

3. use an external merge service like LiveDocx and send/receive merged files using web callouts

    -  taking this approach involves building customisations which effectively replicate what SFDC does. Also, there are governor limits on number of callouts which

4. use a hybrid mail provider who will do the merge and then also print, envelope, stamp & send the letters

    -  this solution is also constrained by the volume limits on sending data (e.g. the merge template and field data) outbound in a web callout (as far as I can tell, there's a 100kB limit on outbound data, whereas a 2 page Word letter merge template with a few images is 230kB). This also ties us to one hybrid mail provider and means we can't choose to print locally if we want.


Has anyone found a way to get the standard mail merge functionality to work within, or had to build or implement similar functionality?



I had a similar requirement of mailing "Capital Call Notices" and "Distribution Notices" , I have customized the whole process as the custom objects cannot leverage the MassEmail Functionality even via code, so we are actually sending individual emails but in a loop.

We give the user a Visual Force Interface for selecting Contacts, then in the next page we prompt the user to select the Template and then it is sent out.

You can build a custom UI for customization of templates too.





Can you please provide some details of the code that you used. This can be very helpful. I am also implementing a similar feature on custom objects. And need to do it in 2 days. Please help me.


Thanking you in advance.



Hi Ispita,


I am currently looking at an option where I need to build the UI for customization of templates for mail merge functionality, also I need to give the user an option to select the template.


Can you please kindly help me on this part with the logic to achieve this functionality and also the time required to complete this.


Appreciate your response:-)


Thanks in Advance!!