# Mail Merge Templates

## Overview

The Mail Merge Templates powers correspondence for mass mailings using Microsoft Word or HTML/PDF including the insertion of content from registers and items to address or personalise for sending to individuals.

Mail Merge templates can be used to generate warnings and notices among other types of correspondence, however they are not used for messaging (for example Email or Text).

HTML templates have the additional ability to include logic for producing [smart templates](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference) that can adapt to multiple uses.

Some common uses for Mail Merge templates:

* Letters, of all types including addressed envelopes
* Compliance, such as to to send warnings, notices to comply. Fire Prevention Notices in Victoria are one example. Permit approve or decline letters are another.
* Court or Prosecution matters, including Appeal letter templates
* Insurance, for example a detailed case profile can be created from the information held in a Cases or Inspections
* Forms generation, including pre-filled forms
* Authorisation letters - for officers or organisations

Administrators can [access](#requests-usingrequests), [view](#viewing-mail-merge-templates), [add](#adding-mail-merge-templates), [edit](#editing-mail-merge-templates) and [configure](#settings) Mail Merge Templates. Once added and configured, users will be able to [generate mail merges](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/bulk-actions#generate-merge) in enabled registers (such as Inspections and Cases) or by editing an item and using the [Correspondence](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items#correspondence) feature in the right hand area settings.

{% hint style="info" %}
While the system has built-in mail merging capabilities, it also supports exporting data from a register to run your own merge externally using a program such as Microsoft Word. The advantage of using the built-in functions is that your system's users don't have to have to use a separate program and it is integrated with the system's workflow and reports.
{% endhint %}

### Access <a href="#requests-usingrequests" id="requests-usingrequests"></a>

To access the Mail Merge Templates register you will need to sign in with [*System Admin & Data Entry* position](https://docs.cw.crisisworks.com/system-administration/configuring-the-system/..#system-administration-positions).

You can find the *Mail Merge Templates* register under **System Administration** **> Mail Merge Templates**.

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2F3eQVTXLt2gMmYnXGvhtE%2Fimage.png?alt=media&#x26;token=781e26dc-300f-46c1-beea-bc437e04316a" alt=""><figcaption><p>System section of the User menu</p></figcaption></figure>

## Viewing

Mail Merge Templates are listed in and searchable via the register [Datagrid](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid#data-grid-view).

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2F6IWGfcAsPUXoQw0QQiVv%2Fimage.png?alt=media&#x26;token=45a80262-ca38-4f7c-b242-bd751b866cfe" alt=""><figcaption><p>Sample Mail Merge Templates datagrid</p></figcaption></figure>

To view an existing Mail Merge Temple:

1. Navigate to the Mail Merge Templates register datagrid.
2. Locate the item you wish to view. The register includes additional filters for Workflow Status (Active/Inactive) and Region
3. Open the item using the ID
4. To return to the Datagrid use the Back button <img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FkJtmQ5qacZpOVfkdqfY8%2Fimage.png?alt=media&#x26;token=b4c68b18-dc6e-48bb-8a2e-c14bf3f595be" alt="" data-size="line">

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FZstgdw5ZZZgHVTTHAr1N%2Fimage.png?alt=media&#x26;token=777640d1-d599-40aa-9b30-f0a47c2deeac" alt=""><figcaption><p>View of a sample Mail Merge Template</p></figcaption></figure>

## Settings <a href="#settings" id="settings"></a>

Mail Merge Templates are divided into the following sections (sections may or may not appear depending on what information is entered, your permissions level, and what mode you're viewing):

| Left Column                         | Right Column          |
| ----------------------------------- | --------------------- |
| [Record Notes](#record-notes)       | [Workflow](#workflow) |
| [General](#general)                 | [Activity](#activity) |
| [Advanced](#advanced)               |                       |
| [Token Reference](#token-reference) |                       |

### Record Notes <a href="#record-notes" id="record-notes"></a>

When editing, record notes in the [rich text field](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items#rich-text-fields) as you make changes which will appear in the Activity log.

Refer to: [Recording Notes](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items#recording-notes)

### General

#### Template Name

Use this setting to name the template. This will appear for end users wanting to generate correspondence so should be suitably descriptive of the template's function and usage.

#### Description

Use this setting to further elaborate on the template's intended usage.

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FSgwImi3XuOiUeXDlfN7n%2Fimage.png?alt=media&#x26;token=beae1f02-4345-477e-a658-63830ed93ad9" alt="" width="375"><figcaption><p>General settings</p></figcaption></figure>

#### **Compatible Registers**

Use this setting to enable or disable the [Correspondence](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items#correspondence) section in specific Registers. Note that this list of registers must still be globally configured for your site in order for you to add or remove them. Add by searching the list and remove using the cross next to each.

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FxeeCPBo1yajkRY2ct3pN%2Fimage.png?alt=media&#x26;token=107be347-3216-47d0-8b15-cfa32cf352b1" alt="" width="375"><figcaption></figcaption></figure>

#### **Template Type**

Use this setting to specify whether the template is a *Microsoft Word* document or *HTML/PDF*.

Use Microsoft Word if your template is straightforward and should you need to make edits post merge. This is the default option.

Use HTML/PDF if you are a power user to get control of your template, including the addition of smart logic using special programming snippets including Cascading Style Sheets (CSS) for layout and styling.

If in doubt, Microsoft Word is the easiest option to both maintain and for end users and other administrators to understand.

### Word Template Settings

#### **Template File**

Use this field to upload your Microsoft Word template file using the [Add File button](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/editing-items#attaching-files).

### HTML/PDF Settings

HTML/PDF templates support additional configuration and flexibility in addition to those mentioned in the above section.

Power users can create and modify advanced templates, or use code snippets. refer to the Technical Reference: [Merge Template Reference](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference).

#### **Template Content**

Use this setting to create or paste in HTML to compose the template. This field supports the insertion of tokens and Smarty semantics. Smarty is a web template engine written in PHP.

Do not use inline styles in your HTML as this can cause the template [not to save](https://docs.cw.crisisworks.com/security-and-support/faqs/troubleshooting/system-administration/mail-merge-your-form-could-not-be-saved), make sure you style your template using the [Additional CSS](#additional-css) setting.

{% hint style="info" %}
Consult the [Merge Template Reference](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference) for more information on the HTML codes you can use.
{% endhint %}

#### **Template Resources**

Use this setting to set where the template's resources are stored. If the template is solely configured in the Mail Merge Templates item then select 'No resources'.

#### **Letterhead background**

Use this setting to upload a blank PDF to serve as the background image to a template. The letterhead can have a header and footer including branding. Multi-page letterheads are possible, however it is recommended to upload a single page only. CSS borders and padding can be used to avoid overlapping merged text with the background.

#### Left Margin

Use this setting to change the indent for the whole left side of the page. The typical default page margins are 20mm. This attribute is defined in the template's [base style](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference/style-your-template#overview).

#### Right Margin

Use this setting to change the indent for the whole right side of the page. The typical default page margins are 20mm. This attribute is defined in the template's [base style](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference/style-your-template#overview).

#### Top Margin

Use this setting to change the indent for the whole top of the page. The typical default page margins are 20mm. This attribute is defined in the template's [base style](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference/style-your-template#overview).

#### **Address Top**

Use this setting to help align *address* to fit within your windowed envelopes. This attribute is defined in the template's [base style](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference/style-your-template#overview).

#### Address Left

Use this setting to help align *address* to fit within your windowed envelopes. This attribute is defined in the template's [base style](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference/style-your-template#overview).

#### Additional CSS

Use this setting to include your own styles using style sheets in Cascading Style Sheet (CSS) format. You will need to include styles in the Template Content HTML in order to modify them using the CSS. Refer to [Style your template](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference/style-your-template) for further instructions.

#### Show Page Header

Use this setting to display the date will appear at the top of each PDF page. Note that this can affect the margins of your page.

#### Show Page Footer

Use this setting to display the date will appear at the bottom of each PDF page. Note that this can affect the margins of your page.

### Advanced

#### Generate one letter per asset contact

Use this setting to generate individual letters to individual contacts where an Asset has more than one contact. For example, a residence may have more than one owner at different addresses, this option will generate a mail merge for each so you can print individual letters and post them to individual owners. Tick this box to enable this option. It is off by default.

#### Process workflow rules when merging

Use this setting to enable a status transition upon generating documents. Some registers support processing workflow rules when merging templates. For example, the Status of Fire Prevention Notices will usually go from Hazard Exists to Hazard Exists (Printed) when a notices are printed. This will enforce that rule. Tick this box to enable this option. It is off by default which means you would have to manually set the status on any items.

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FZgJ6ked3noRHiQMPEghE%2Fimage.png?alt=media&#x26;token=46158dd0-73b6-405a-871e-dfc74958ec1f" alt="" width="375"><figcaption><p>Advanced Settings</p></figcaption></figure>

### Token Reference

This is not a setting as such, but it has a useful list of tokens which get replaced by actual data from the corresponding field of the register item when the merge is generated. Each token is accompanied by a description of its potential use in your template.

{% hint style="info" %}
Tokens will only work in a register if that register you are generating the correspondence from contains those fields.
{% endhint %}

You can copy and paste, or use the token code or use the icon <img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FBNLk5mnClDityHWWgVk0%2Fimage.png?alt=media&#x26;token=294d0b19-d8e8-48d3-96f1-edda891de48c" alt="" data-size="line">to copy it to your clipboard. Put these in your Word file or HTML to automatically insert text from the item into the output file when it is processed.

For example, placing the text *${MERGE\_DATE}* into your template document will output the current date when you process the merge.

<figure><img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FLfEQVAJDN29eeVsu8PdO%2Fimage.png?alt=media&#x26;token=4e2fc11c-e994-47d8-b5e2-6a1ba75e4c5c" alt="" width="375"><figcaption><p>Extract from the token reference</p></figcaption></figure>

{% hint style="info" %}
Tokens sometimes get updated so it is a good idea to check and update old templates for any errors or updated tokens.
{% endhint %}

### Workflow

#### Status

Use this setting to activate or deactivate your templates. Inactive templates cannot be added to users but can be reactivated and re-added if needed.

### Activity

Refer to: [Viewing Items: Activity](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/viewing-items#activity)

## Editing

Mail Merge Templates can be edited from the datagrid.

1. Navigate to the Mail Merge Templates register
2. Locate the Mail Merge Template you wish to edit by using the Edit button <img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FMAt3SdDCVeaavZpkxUrB%2Fimage.png?alt=media&#x26;token=bf8178b8-3a9c-4b0d-9c30-009542c2ad7b" alt="" data-size="line">
3. Make the necessary changes to the [settings](#mail-merge-template-settings-word-and-html-pdf)
4. Save <img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FN4Q1ymwZJ5s252DI8Xac%2Fimage.png?alt=media&#x26;token=ea3758c1-f326-47ba-ac4c-c1460bcfcd0f" alt="" data-size="line"> to save your changes

## Adding

To add a mail merge template:

1. Use the [New Item button](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/adding-items) for New Mail Merge Template <img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FzBoou9zQo3HdS87HoLUU%2Fimage.png?alt=media&#x26;token=0e6a0452-f617-4793-bec3-9d1b48e94705" alt="" data-size="line">
2. Enter a **Template Name** and choose at least on **Compatible Register**
3. Select a **Template Type** (MS Word or HTML/PDF) and upload or insert the template
4. Configure any additional [settings](#mail-merge-template-settings-word-and-html-pdf) as needed
5. Use the **Save** button <img src="https://3923904090-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNy7IznbrPLUq6GJDDQDk%2Fuploads%2FWyvhwIZJBvXfK2U8LqPC%2Fimage.png?alt=media&#x26;token=79843521-0f38-4c32-b05b-3fa126a9b4e6" alt="" data-size="line">

## Bulk Actions

{% content-ref url="../../concepts-and-fundamentals/on-a-computer/using-the-datagrid/bulk-actions" %}
[bulk-actions](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/bulk-actions)
{% endcontent-ref %}

The following additional bulk actions can be performed via the Actions menu:

| Action                    | Description                                                                                                                                                                                                                                        |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Copy IDs                  | Refer to: [Copy IDs](https://docs.cw.crisisworks.com/concepts-and-fundamentals/on-a-computer/using-the-datagrid/bulk-actions#copy-ids)                                                                                                             |
| Create a Copy of Template | <p>Refer to: <a href="../../../concepts-and-fundamentals/on-a-computer/using-the-datagrid/bulk-actions#create-a-copy">Create a Copy</a></p><p>Creates a Draft copy of the Mail Merge Template.</p><p>Only available when an Event is selected.</p> |
