Issue

There are several possible causes for the following error message: One or more templates failed to merge or operation was cancelled:

  1. Related to a bad merge field or mismatching TableStart and TableEnd merge fields in a detail region.
  2. Data containing double quotes are being merged into a Microsoft Word IF Statement.

Workaround

A good start is to remove paragraphs (or entire pages for larger templates) and repeat the merge until you find the issue. Then you can correct the detail region or IF Statement causing the problem.


If the issue is with a detail region:

You can receive this error message if the TableStart and TableEnd merge fields are not in the same row of the detail region. The correct usage of TableStart and TableEnd merge fields looks like:

If the issue is with an IF Statement:

  1. Remove the double quotes from the field.
  2. Create a new formula field or DV0 parameter and reference the value of the existing field in a Salesforce SUBSTITUTE formula to remove all double quotes from the field value. Then reference the new formula field or DV0 parameter within the IF statement.