Contact us Blog

Generating thank-you letters using Document Merge

Acknowledgement and thank-you letters are an essential part of maintaining relationships with your contacts. If you are a non-profit organization, you would want to send thank-you letters each month, to the donors who donated during that month. Such letters might be generated from a template you have prepared, containing place-holders for the contact's name, address and related information. With Apsona's document merge feature, you can use a Word template to generate such letters to a filtered list of contacts with just a few clicks. This assumes that you have the Apsona Document and Email Merge add-on installed and available to you.

Setting up the merge action

Usually, such a letter contains boilerplate verbiage for the acknowledgement, along with contact information (name, address, phone number, etc.) and information about the opportunity or donation that you are acknowledging (amount, close date, campaign, attribution, and the like). In Salesforce, these two kinds of data are linked via the Opportunity Contact Role object. Therefore, to produce a list of such letters, you would need a list of field values from the Contact, Opportunity, and Opportunity Contact Role objects. You can produce such a list in one of two ways:

The choice between these two alternatives depends on the specific data values you want included in your template. If you have no calculated values (such as total amount or most recent close date), either approach will work. If you need calculated values, however, you are better off using a report.

Note that both of these alternatives require the Opportunity Contact Role (OCR) item to be available in your Apsona menu bar. If you do not see the OCR object in the menu bar, you will need to configure your menu bar as described in our documentation of access permissions.

The general outline of the process is as follows.

  1. Create a template. This can be just a usual Word .docx file, containing merge fields that serve as place-holders for the data values (e.g., contact name, address or donation amount). Upload this file into your Documents object in Salesforce.
  2. Create a record list. You can use either an Apsona report from the Opportunity Contact Role object or the object itself, as noted above.
  3. Initiate the merge. If you are using the Opportunity Contact Role object directly, you do this by clocking Tools - Merge/Mail. If you are using a report, you would run the report and then click the Merge/Mail button.
  4. Select the Merge action Select Document merge from the 4 merge options available and click Next.
  5. Select the Document template Click the drop down for the Document template to use. All the docx files stored in Documents will show up. Select the relevant docx template from the drop down.
  6. Select the Output format Select one of the available output structures - Single .docx file with page breaks or Separate .docx files, one for each record. Click Next.
  7. Match merge fields Merge fields from the docx file will show up to the left of the data fields. The data fields here are all the fields in the report you have run. Match each merge field from the document to a corresponding data field in the report. Click Next. If you are running the merge directly from the OCR object, map the data fields with the fields from the relevant objects
  8. Log merge action Choose the options for logging, provide a name for the merge action, and click Finish.
  9. Download the results. Click download results and print the letters.
Note that steps 4 through 8 are actually setup steps that create a new merge action. Once you have created the merge action with a name, it will be saved and become available for running without having step through the wizard again. Below is a video demonstrating this process.

Creating a button in a Salesforce detail page

Once you have set up the merge action as described above, you can use it to create a button in either the Opportunity or the Contact detail page to generate the letter. See the button creation page for details about how to create buttons. Since the merge action is based on the Opportunity Contact Role object (or report), it will have available both the Contact ID and the Opportunity ID, so it can be used in either of those detail pages.

Bear in mind, though, that if you create a button for the Opportunity detail page, then the report you are using must generate at most one Opportunity Contact Role record for a given Opportunity record. For example, it can use a filter condition of Primary = true to ensure that only the primary donor's contact info is generated by the report. This way, when you click the button on the Opportunity detail page, it will use just the one record to produce the correct Contact to whom the thank-you should be sent. Without such a filter condition, if an Opportunity has more than one Contact Role associated with it, the merge action cannot uniquely identify the Contact who should be thanked.

An example merge action

We have made available a simple merge action that you can use, either as an example or perhaps as starting point from which to build your own. This merge action is intended to generate a thank-you letter for a single gift. It uses a single-step report on the Opportunity Contact Role object and a very minimal Word document template. You can download the merge action package as an Apsona item, and import it into your org as described in the documentation on Apsona items. Once you have done this, you will find
  1. A .docx template named Single donation thank-you letter in the folder you select when you import the item;
  2. A report named Single donation, which you will find when you navigate to the Reports menu under the Opportunity Contact Role object; and
  3. A merge action named Single donation thank-you letter which will become available when you run the above report.
You can then customize the report, template and merge action according to your needs.

Download the merge action item
How to import this into your Salesforce org

See also the example of year-end tax letters by household.