Create and Edit Templates
Availability: The creation of templates and their editing are available from eWay-CRM version 9.3.
eWay-CRM Online allows you to edit the template used to export items to Word or PDF. Templates are managed in eWay-CRM Online and are then available in both eWay-CRM Online and eWay-CRM Desktop.
This article describes how to modify a template, the basic rules, and what you need to know.
For details on how to upload a template for different item types and languages, see Settings > Templates.
Content
- How it works
- Currently supported variables
- How to get a field name
- Listing all related items
- Tables in a template
- Inserting images
- Special variables
How it works
A template is a DOCX file created in Word. eWay-CRM searches it for textual occurrences of special placeholders with dollar variables, similar to those used, for example, in SQL# syntax in advanced workflows — see the article System Variables Available in Actions.
In practice, it works as follows. The template might contain the line:
Offer No. $CURRENT_ITEM[FileAs]
When the item is exported to Word or PDF, the resulting file will show:
Offer No. 20250123
— meaning the actual name of the offer was inserted. If the referenced item or value does not exist, only a blank space will appear instead of $CURRENT_ITEM[FileAs].
Currently supported variables
For basic text replacement, the following variables representing the entire item are currently supported:
- CURRENT_ITEM
- CURRENT_ITEM_OWNER
- CURRENT_USER
- SUPERIOR_ITEM
- Folder_RELATIONTYPE_RELATION_ITEM (see below)
Square brackets after the variable contain the field name, e.g. [FileAs]. All field types are supported, including user fields, except image fields. The textual representation of a value is always used, meaning:
- for relation fields, the name of the linked item is inserted,
- for a checkbox field type, the value Yes/No is displayed,
- for a date field, the value is displayed according to the template language — for English, in the format 01/31/2025.
- for checkbox lists, values are joined by commas,
- for multi-line text fields (e.g., Notes), line breaks are preserved, but formatting such as bold text is not.
How to get a field name
To obtain a field name, open any item in the selected eWay-CRM Online module and hover your cursor over the field. Its database name will appear in the tooltip.

When writing the field name in the template, always use the correct capitalization — otherwise the placeholder will not work. For example, write FileAs, not fileas or Fileas.
Listing all related items
Another special variable that can be used is a relation of a specific type to a given module, following this general format:
Folder_RELATIONTYPE_RELATION_ITEM
Here, Folder represents the table (module) from which the related item is taken, and RELATIONTYPE is the relation type.
For example, for items in a shopping cart, the syntax would be:
$GoodsInCart_GOODSINCART_RELATION_ITEM[Code]
If this variable appears in normal text, it is treated as one static item — the first related item linked to the main record in the database is used. This is useful, for instance, when filling in the customer of a project.
Behavior in a table:
If the relational variable is used in a table, the row containing the variable will be repeated as many times as there are related records in the database — or zero times if none exist. Each row will be filled with one related record. The footer (the bottom row/rows of the table) can also contain static variables, such as Total Price, etc.
Additional details:
- Tables containing only static variables are not repeated — each variable corresponds to at most one item.
- If a repeated row also contains a static variable, it is evaluated as well.
- If a repeated row contains multiple relational variables, the relation with the most related items serves as the source of duplication. Other relational variables act as static ones (their content is filled from the first related item).
- Related items are fetched from the database, sorted in ascending alphabetical order by
FileAs, except in modules Document Items (sorted by order) and Calendar, Documents, Emails, Journal, and Tasks (sorted ascending by creation time on the server).
Example:
A table like this in the template:
| Code | Name |
|---|---|
| $GoodsInCart_GOODSINCART_RELATION_ITEM[Code] | $GoodsInCart_GOODSINCART_RELATION_ITEM[FileAs] |
will be replaced by:
| Code | Name |
|---|---|
| S01 | Screw M1 |
| M01 | Nut M1 |
| SRV | Service |
The mechanism does not alter the DOCX formatting, so the template creator retains full control over the output.
However, it may cause layout issues if, for example, a placeholder like $GoodsInCart_GOODSINCART_RELATION_ITEM[Code] is placed in a very narrow, non-wrapping table cell.
Tables in a template
Variables can be long and may stretch table columns undesirably. By default, Word automatically resizes tables to fit text. But sometimes you want the table to stay fixed.
| Code | Name | Quantity | Sales Price | Total Price |
|---|---|---|---|---|
| $GoodsInCart_GOODSINCART_RELATION_ITEM[Code] | $GoodsInCart_GOODSINCART_RELATION_ITEM[FileAs] | $GoodsInCart_GOODSINCART_RELATION_ITEM[Quantity] $GoodsInCart_GOODSINCART_RELATION_ITEM[UnitEn] | $GoodsInCart_GOODSINCART_RELATION_ITEM[SalePriceExcludingVAT] $GoodsInCart_GOODSINCART_RELATION_ITEM[SaleCurrencyEn] | $GoodsInCart_GOODSINCART_RELATION_ITEM[PriceTotalExcludingVAT] $GoodsInCart_GOODSINCART_RELATION_ITEM[SaleCurrencyEn] |
| Total | $CURRENT_ITEM[PriceTotalExcludingVAT] $CURRENT_ITEM[CurrencyEn] | |||
When you create a table and insert a placeholder, the column expands. If you try to make it narrower, it won’t work because placeholders don’t wrap. Solution: Click inside the table, go to Table Layout on the ribbon, and under AutoFit, select Fixed Column Width.
You can then manually adjust the column width as needed.

Inserting images
The export supports item profile images, but inserting them into a template works differently from text variables.
Insert an image into the DOCX template (for example, a white rectangle or a logo), set its dimensions and position, and in the Alt Text field enter the relevant variable, e.g.: $CURRENT_ITEM[ProfilePicture]. In the output, the image keeps its parameters, including size, but is replaced with the image from the item.
If the item does not exist or has no image, the placeholder image remains (to preserve layout) and is not deleted.
Image export also works in repeated tables and for related items — each row in the table will display the image belonging to the corresponding item.
Special variables
To maintain backward compatibility, the export also supports two additional dollar variables: MY_COMPANY and SYSTEM_DATA. For example, you can use: $MY_COMPANY[MyCompanyVatNumber] or $SYSTEM_DATA[DefaultCurrency]. For more information, please contact eWay-CRM Support.