Edit a document template with mail merge
Follow step-by-step instructions to edit a document template with mail merge.
Cin7 Core have a dedicated support team for resolving template issues, don't hesitate to contact Cin7 Core Support for help.
Open a template
Open the template management page by going to Settings → Document & Email Templates. Here you will see a collection of document and email templates, fully customizable in MS Word. The templates are organized according to module.
When you select a template, you're given the option to download the Word template to be able to edit it on your computer as well as reset the template to the original. You will then need to select the relevant template type which will determine where that template can be used as well as its position in the template dropdown when you try to generate a document.
You can give the template a unique name. For example, if you have variations of purchase orders or sale orders which go out to different suppliers and customers, you're able to name these templates respectively and can easily find them in the dropdown when trying to create a document.
You also have the option to browse for a previously saved document on your computer as well as browse for a previously saved template to be used as an email template.
Let's open an existing template in Microsoft Word - it will display the structure of the template including all tables as well as mail merge fields which will be populated when this document is generated.
How mail merge works
You'll find that every template will begin with TableStart and end with a TableEnd mail merge field. These mail merge fields determine the section of Cin7 Core where information to populate this template will be sourced from.
You will need to make sure that you preserve the table structure. If the structure is not preserved, your template will not work.
Find mail merge fields
You can find all the various mail merge fields that belong to that particular section within the following articles. You can only use fields for a specific table within a mail merge table. For example, TableStart:Purchase and TableEnd:Purchase cannot use sale fields, only purchase fields.
Mail merge fields for sale process, combined sales, and customer statement templates
Mail merge fields for financial templates (Expense Claims and Receipts)
Use mail merge to add a field
If you wanted to change or add any of the information for the supplier, you will need to copy an existing field, paste it back in, then right-click on the field to toggle field codes, which will essentially show the contents of the field.
For example, if you wanted to add a supplier fax number to the purchase order, you will need to go to the purchase KB page and in the purchase table, you will need to find the Supplier fax field code in the Cin7 Core Help Center.
You will need to copy the supplier fax field, return to the document, and then replace supplier email with supplier fax.
We can then right-click and update the field which would update the contents of the field and reflect them in the field name.
You have another option for displaying mail merge fields for Windows users. You can press ALT and F9 together which will display all mail merge fields available in the document including any IF functions as well as tables within the IF functions. For Mac users, those buttons are OPTION and F9.
Make changes to tables
Let’s also take a look at how changes can be made within tables especially those hidden within IF functions.
By pressing ALT and F9 together, we can reveal all the mail merge fields. To make a change within the table, for example, if we want to get rid of a particular column, we'll need to select that column and then delete it.
To reflect that change in the mail merge field, we'll press ALT+F9 again, right-click on the field and update it. That will get rid of the particular column we deleted within the IF function.
Take care when deleting columns or making any changes in the tables. Make sure that you press ALT+F9 if you're making any changes. For example, if you were to make a change to this table without exposing the IF function that change will not take place.
For example, if I delete this Price column, if I was to update the field, the Price column will come back. This is due to the fact that the mail merge field simply displays the table. It doesn’t actually allow you to make any changes to the table without exposing the IF function first. If I delete the Price column out of the table within the IF function, when I press ALT+F9 to hide the mail merge fields then update the field that will get rid of the Price column for me.
The same works in reverse when adding columns. You will need to press ALT+F9 to reveal the table and insert a column. For example, if I wanted to populate Additional Attribute 1, I then need to copy the existing field, paste it in then paste the field. I will need to find the PO Lines table which will be used to populate the information in this table.
We need to return to purchase mailmerge article, find the PO Lines table and then copy AdditionalAttribute1, return to the template and then replace Unit with Description, press ALT+F9 to hide the field, and then update it. This table will now be included in the extra column which will be used to complete the item’s description.
Add images
You can add images anywhere in the document template without worrying about the mail merge structure. Use Insert pictures or simply copy-paste the image into the template.
Once you've inserted the image, you may have to change the text wrapping for the image. Generally, the In Front of Text option allows you to position the image anywhere you like.
Mail merge table and field structure
All sections in a template must be contained within TableStart and TableEnd tags. This defines which table the mail merge fields data will be pulled from.
Templates will start and end with the parent TableStart and TableEnd tags, e.g. «TableStart:Purchase» and «TableEnd:Purchase». Child TableStart and TableEnd tags can be placed within the parent tags.
Tables that may have multiple lines generated in them, for example, tables with sale order lines, purchase order lines, or additional Charges, will have TableStart and TableEnd tags within the table itself. e.g. «TableStart:POLines» and «TableEnd:POLines». These are child tags that will be found within the parent tags.
TableStart and TableEnd tags that end in Details (POLineDetails, InvoiceDetails etc.) are for matrix documents, e.g. Purchase Order Matrix, Invoice Matrix.
If you need to customize standard templates, make sure that the opening tag for any table «TableStart:NAME» has the matching closing tag «TableEnd:NAME», or your template will not work. Try to change the structure as little as possible to preserve the template functionality.
Sample Structure:
The most important thing to remember when making changes to templates is to change the FIELD CODE, not the FIELD NAME.
Right-click any <<field name>> and click Toggle Field Codes to show the field code (displayed as {MERGEFIELD field code}).
Windows users can toggle all field codes by holding down ALT + F9.
Mac users can toggle all field codes by pressing OPTION + F9.
<<FIELD NAMES>>:Don't change these.
{FIELD CODES}: Change these.
Once you have made your changes to the field code, right-click and click Update Field for the changes to take effect.
Examples
Here you can find instructions for common template editing scenarios.
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB
- Publish to everyone.4.log-2010416261.zip30 KB