Skip to main content

Customize billing document templates using Word Mail Merge

Zuora

Customize billing document templates using Word Mail Merge

This article explains how to create a custom billing document (invoices, credit memo, and debit memo) template using the Microsoft Mail Merge feature. It also explains the Mail Merge features that apply to the billing document template. For more specific information about Mail Merge, refer to the Microsoft Office Word documentation. If you are using a version of Word that this article does not cover, refer to the Microsoft Office Word documentation for the exact steps to work with the Mail Merge features.

Insert a Mail Merge field in a billing document template

You can create a custom billing document template using the Microsoft Mail Merge feature, as well as insert mail merge fields to a template and customize the format, and use the mail merge tables to add multiple line items to a template.

Insert a Mail Merge field in Microsoft Word 2007 and Word 2010

To insert a mail merge field in your template in Word 2007 and 2010, complete the following steps:

  1. In Word, click Insert > Quick Parts > Field.
  2. In the Field dialog box, click Categories and select Mail Merge.
  3. In the Field names field, click MergeField.
  4. In the Field Name field, enter the name of the merge field that you want to insert, for example, Account.Name. The merge field is inserted in your document. For example, if you added the account name, Account.Name, in the document, the field will be displayed as: «Account.Name». See Supported Merge Fields for a list of available merge fields. 
    MergeFieldName.png
  5. Click OK.
  6. Save the template file as the Word 97-2003 Document (.doc) type.

Insert a Mail Merge field in Microsoft Word 1997 to Word 2003

To insert a mail merge field in your template in Word 1997 to Word 2003, complete the following steps:

  1. In Word, navigate to Insert > Field.
  2. In the Field dialog box, click the Categories arrow and select Mail Merge.
  3. In the Field names field, click MergeField.
  4. In the Field name field, enter the name of the merge field that you want to insert, e.g. Account.Name. The merge field is inserted in your document. For example, if you added the account name, Account.Name, in the document, the field will be displayed as:  
    «Account.Name»
  5. Click OK.

Insert a Merge Field in Word for Mac

To insert a mail merge field in your template in Word for Mac, complete the following steps:

  1. In the Macintosh Word, navigate to Insert > Field.
  2. Click the Categories arrow and select Mail Merge.
  3. In the Field names field, click MergeField.
  4. In the Field codes field, enter a space after "MERGEFIELD" then type the field name you want to insert, e.g. Account.Name. For example, if you have " MERGEFIELD Account.Name" in the Field codes field, in the document, the field will be displayed as: 
    «Account.Name»
  5. Click OK.
  6. Save the file in the Word 97-2004 Document (.doc) format.

Edit a Mail Merge field in a billing document template

To update a merge field using Edit Field on Windows, complete the following steps:

  1. In your template document, right-click on the merge field you want to edit and select Edit Field.
  2. In the Field name field, enter the new merge field name.
  3. Click OK.

To update a merge field using Toggle Field Codes on Windows and Mac, complete the following steps:

  1. In your template document, click the merge field you want to edit.
  2. Toggle the field code and result:
    • Press ShiftF9 on Windows.
    • Press option + fn + F9 on Mac.
  3. Edit the field name in the field code.
  4. Update the field:
    • Press F9 on Windows.
    • Press option + fn + F9 on Mac.
  5. Repeat Step 2 to verify that your change has been saved.

You cannot change a merge field by simply typing a new merge field over the current field.

Generate multiple line items using Mail Merge table

To generate multiple line items in a billing document, use the mail merge tables.

  • To mark the beginning of a mail merge table, insert a mail merge field with the name TableStart:MyObject, where  MyObject corresponds to the name of a multi-line object.
  • To mark the end of the mail merge table, insert another mail merge field with the name TableEnd:MyObject.
  • Between the TableStart and TableEnd marking fields, place the merge fields that correspond to the fields of your table columns. These merge fields will be populated with data from the first row of the multi-line object, then the following rows will be populated with the data from the object. 

For example, to generate multiple line items on an invoice item, create TableStart:InvoiceItem and TableEnd.InvoiceItem merge fields in your template, where InvoiceItem is a multi-line object. You can create this merge field just like any other merge field, but this field specifies which region will be repeated for each of the Invoice Items.

Multi-line items can be displayed within a table and cannot be displayed in other areas of billing document templates. The following objects are multi-line items that you can use with TableStart and TableEnd merge fields.

  • OpenInvoice: The Invoice multi-line fields correspond to open invoices. This differs from the Invoice fields which are associated with the current invoice. 
  • InvoiceItem
  • TaxationItem
  • TaxSummary
  • Usagelines
  • UsageSummary
  • Adjustment
  • Payment
  • Subscription
  • Transaction
  • CreditMemoItem
  • DebitMemoItem

Use the sort order described Changing the Sort Order on a Table when defining products if you have specific ordering requirements.

What to do next

Next, use the advanced mail merge functionality to further customize your billing document template by defining the format for date and number fields.