Application management : Business intelligence & reporting : Reports : Mail Merge Report Definitions : Creating a mail merge definition and a template file
Creating a mail merge definition and a template file
Creating a mail merge definition is slightly different from creating a normal report definition. You can use the following procedure to create a mail merge definition:
Procedure
1. Open the template file you have created, with the required text and (preliminary field) names between the angle brackets, or in the case of a HTML template, between the characters representing angle brackets (< and >).
The exact merge codes can be copied later (in step 9 of this procedure).
2. On the action panel of the relevant business object, for example Orders, select Reports and select the Add option.
The Report definitions and settings window opens.
3. In Settings, in the Type field, select the Mail merge option.
4. In the Name field, type a name for the report.
In the Template field, select the correct template file (the template file you have opened in step 1 of this procedure).
Note that when using multiple property sets, the mail merge functionality may be affected, if each property set has its own WebDAV server (and file location). The Template field now shows files of each available property set.
There should at least be one template file selected.
If there is a template for the current property set, it will be linked to the current property set.
When upgrading to the current release - in the Cloud - template file references will be updated accordingly, but the file will actually be have to be copied manually. For on-premise, this will have to be arranged manually.
5. In the Custom file name field, click the button to use the Expression builder to specify an expression on which the file name is to be based. The generated file name will comprise the result of the expression, appended by a random number. This prevents overwriting of the existing files when the same report is executed multiple times.
For details on using Expression builder, see Working with Expressions.
6. In the Email subject field, click the button to use the Expression builder and specify an expression on which the subject line is to be based that is used in notification and confirmation emails.
* 
It is highly recommended to specify an expression in this field. The expression you specify here will be used to populate the subject of the mail that is sent as a notification or a confirmation mail. This field is only used if this mail merge report is used in a notification or for sending the confirmation mails. For details on using Expression builder, see Working with Expressions.
* 
If this field is not populated,
•    for notifications, the name of the notification definition is used. If there is no name either, the notification definition's code is used.
•    for confirmation emails, the subject that is defined on creating a mail is used.
7. In the Available fields section of the Report definitions and settings window, start selecting the (reference) fields you want to include in your mail merge definition and subsequently save the definition.
For more information on including fields, see To add a new user report definition.
8. In Selected fields, select the first field from the list.
9. In Settings, copy the field's merge code from the Merge code field to the correct position in the opened template file.
In the case of a HTML template, ensure the merge code is placed between the characters representing angle brackets (< and >).
10. Repeat copying and pasting merge codes for each field in Selected fields (the mail merge definition) until all merge codes have been included in the correct location in the template file.
11. Only when your template is not using the UTF-8 encoding with Unicode BOM, you should fill in the Template encoding field to explicitly specify the encoding your template is using. Enter a valid encoding name. You will receive an error message if you enter a wrong encoding name.
* 
A list of valid encoding names is published and maintained by the Internet Assigned Numbers Authority in the IANA Charset Registry: http://www.iana.org/assignments/character-sets
Planon ProCenter will always attempt to automatically detect the used encoding from the Unicode Byte Order Mark (BOM) on the template file itself, but in some cases this is not possible. If the encoding is not detected automatically, the Template encoding specified in the report properties will be used.
File encoding is usually not detected if:
•    The file is encoded in some legacy encoding such as ISO-8859-1, (or)
•    The file is encoded as Unicode, but without Byte Order Mark.
12. Save your template file.
13. Save the mail merge definition.
You are now ready to generate the mail merge report(s).
When the system setting Apply UTF-8 for Mailmerge is not changed (it is on Yes), the output reports will be encoded in UTF-8. Only then can we guarantee that all symbols can be used in reports without issues.