Merging with templates

F2 Merge Codes makes it possible to automatically merge data from F2 with templates for Microsoft Word. Create templates directly from the main window on the “Settings” tab by clicking on the Document templates menu item.

document templates menu item
Figure 1. Accessing templates from the main window

The “Templates” dialogue offers an overview of existing templates available in F2 and the option of creating new templates.

Create a new template by writing its content in an editor outside F2 and then importing the document via the “Templates” dialogue. F2 Merge Codes supports the following types of files: DOTX, DOTM, DOCX, and DOCM.

image4
Figure 2. The “Templates” dialogue

Right-click on a folder to add a new template. Any user can add templates to their personal and their unit’s folders, while users with the “Template administrator” privilege can add templates that the entire organisation can access and use.

New document from template

Templates with merge codes work much the same way as regular templates. Attach the template to a record by clicking on New document from template in the record window ribbon. When the document template is attached, F2 immediately replaces all merge codes with the corresponding information retrieved from the specific record and its participants.

create document template
Figure 3. “New documents from template” in the record window
Data from records and cases are merged immediately when a document from a template is attached. It is therefore important to ensure that all relevant information is already saved on the record and the case before attaching the template. Later changes to the metadata will not be merged with the generated document.

F2 will display a warning dialogue if a template containing merge fields is attached to a record with unsaved metadata (e.g. “Record participants”). This dialogue prompts the user to save any changes to the record before attaching the template.

The reason for the warning is that the database has not been updated with the latest information from the record. The database is only updated whenever a record or a case is saved. F2 displays a similar warning when a user attempts to attach a template to a record while editing it, as any unsaved changes will not be merged with the template.

Disable template merging

The merging of data with document templates can be disabled for specific templates in F2. This is useful if the merging fails, but it is necessary to create the document regardless. Click on Document templates in the ribbon of the “Settings” tab. Right-click on the relevant template and select Properties to open the “Document properties” dialogue. From here, the merge engine can be changed to “None” as shown in the example below.

image9
Figure 4. Template properties in the “Document properties” dialogue

Example of merging data for a letter

The following example demonstrates how merge codes can be used in a standard letter with a single recipient. The template for the letter contains a number of merge codes listed in the table below.

The “Merge field” column contains the names of the fields in the database (metadata), and the “Description” column describes the content of the corresponding metadata field.

Merge field Description

dossier_party_1_name

Recipient’s name

dossier_party_1_address1

First line of recipient’s address

dossier_party_1_postalcode

Recipient’s postcode

dossier_party_1_city

Recipient’s city

dossier_sendername

Case manager’s name

case_f2casenumber

Case number

The corresponding merge codes are created by adding “$” before and after the merge fields' names. Below is an example of a letter template with a single recipient (record participant):

image11
Figure 5. Letter template with merge codes for a single recipient

A letter template added to a record with the four following metadata fields will produce a letter like in the figure below:

  • Case manager = Ann Sekner

  • Case number = 2020 - 19

  • Participant = Anne Andersen

  • Participant’s address = 24 Parkstreet, 1234 Cityburg

image12
Figure 6. Single recipient letter generated from letter template with merge codes