A mail merge is the process of generating form letters and documents that are personalized for the recipient, who is often get the data from database.
Salesforce have with this functionality from long time back, where you can define templates and to include variables into the document generated, it called merge fields. In Salesforce, you can use data from records, for example Contact Name, Account Name and Address displays in the generated documents.
You can generate single or mass document in Salesforce:
Single Mail Merge Documents
To generate a Microsoft Word document for an individual record, open the record’s detail page and click Mail Merge on the Activity History
related list. Just make sure to add Activity History related list to the page layout.
Once you click Mail Merge button, it will open Mail Merge page, record to merge will be automatically populated. For custom object, you will be asked for contact to merge with the Word document.
If you select Log an activity
button, new task page will be presented for you to enter information for the task.
Salesforce has ending support for Standard Mail Merge on March 4, 2017
, read this
Mass Mail Merge Documents
It only support Accounts, Contacts, and Leads. Click the object tab and select Mass Mail Merge
There are 2 type of mail merge available in Salesforce and you only can activate one for the whole organization:
Standard mail merge
Standard mail merge requires:
- Microsoft® Internet Explorer® versions 7, 8, 9, 10, and 11
- Microsoft Word 2003 or 2007
- Microsoft Windows® XP and Windows Vista® (32-bit only)
For standard mail merge, you will ask to install ActiveX the first time you use it. When you click Generate button, Ms Word opens with your generated document and you can Save As to a folder as per normal Ms Word.
Extended Mail Merge
Extended Mail Merge do not require to any specific browser or specific Ms Word version. To enable Extended Mail Merge, navigate to Setup | User Interface
, enable Activate Extended Mail Merge
. If you do not see this option, log a case to Salesforce Support to enable it. Once you activate Extended Mail Merge, it will affect to the whole user in the organization, this mean no user will use Standard mail merge anymore.
In Extended Mail Merge, when you click Generate button, the document generated will be put in Salesforce Document object. You get an email with a URL to download generated mail merge documents. Example: Your salesforce.com mail merge request is complete. The generated files have been added to your documents tab: http://na3.salesforce.com/01550000001XrnD Please note that these files count towards your organization’s storage limits.
Generate Mail Merge Template
To use mail merge, you need to create mail merge template, which is Microsoft Word documents with merge fields that reference salesforce.com fields.
If you are using Microsoft Word 2002, 2003, 2007, you can use Connect for Office
to insert field quickly. If you use newer Microsoft Word, such as version 2010 or 2013, follow this step:
- Place your cursor where you want to insert a merge field.
- Select the Insert
tab on the ribbon, click Quick Parts
in the Text group, and then click Field...
- Select Mail Merge
in the Categories drop-down list.
- Select MergeField
in the Field names box.
- In the Field Properties area of the Field name box, manually enter the valid merge field, such as ACCOUNT_NAME.
- Click OK.
You will see the merge field added in Ms Word, such as: Account Name: «ACCOUNT_NAME»
Save the document and upload to Salesforce from Setup | Communication Templates | Mail Merge Templates
Here is the guide line for the merge field name: ObjectName_FieldName, such as: ACCOUNT_NAME for standard object and field, for custom object is the same OBJECT1_RATING. If you note here, it is a not API field name.
There is a tool SForceMailMerge
to help us to get the right merge field name easily:
Change the instance to your Salesforce instance name and put a sample record for that object in id parameter.
- Not able to replace Mail Merge Templates document
- Only following fields can be used in merge document:
- fields from the base object, including formula field and roll-up summary field
- user fields
- organization fields
- parent object fields for master-detail relationship
- Not able to use data from child records, you need to use 3rd party app such as: Conga Composer, Drawloop, or S-Docs.