Document templates in Bitrix24 (Alaio) generate a contract, invoice, or act straight from a deal card: a docx file with merge fields is filled with CRM data in one click. This saves hours while the template is simple — and then come "the amount in words", dates in the right grammatical case, and empty requisites in the finished contract. Let's break down creating a template, the merge-field syntax, and the technique that covers every complex case: preparing values with robots before generation.
How do you create a document template?
CRM → Settings → Document Templates (or straight from the card: "Document" → "Add new template"). A template is an ordinary docx file where, in place of data, field codes sit in curly braces: {DocumentNumber}, {Today}, {Client}, plus deal fields and both parties' requisites — Bitrix24 shows the full list of codes on the template page. Upload the file, mark which CRM sections it's bound to (deals, smart processes), and which My Requisites the seller is inserted from. After that the document is created from the card: values are merged in, the file is saved to the timeline, and a printable form and a PDF are available via the link.
Which fields and modifiers are available in a template?
Three groups of data are merged in: document fields (of the deal, lead, or smart process) — including custom ones; both parties' requisites — as separate codes for the organization and bank details; and service fields — number, date, author. Format modifiers apply to fields: a number without decimals, a date in short format, grammatical cases for full names. Modifiers handle typography, but not logic: "if the field is empty, insert a dash", "deadline = signing date plus five days", "amount with the discount applied" — none of that exists in templates. The boundary runs like this: the format of a value goes through a modifier, the calculation of a value goes through the process before generation.
How do you insert the amount in words and calculated values?
There's one technique and it works for any "non-standard" field: create a custom field in the deal or smart process for the result, calculate it with a robot in the business process, and reference that field in the template. Dates in the right form: Date formatting prepares "June 12, 2026" from the system value. Calculated values — VAT, the discounted total, the remainder, the validity period — are computed by a chain of robots into the same place. How an amount is spelled out on the page is a separate question and belongs to the template: decimals, a thousands separator, a currency code are all applied to the field by a modifier in the docx, with no robot involved. That way the template stays a simple docx, while all the logic lives in the process, where it's visible and changeable.
How do you avoid generating a contract with empty fields?
The most expensive template mistake is "Tax ID: __" in a signed contract. The safeguard goes into the business process before generation: the Check if a field is filled robot checks the critical fields one by one — amount, deadline, the company link the requisites hang off — and returns a Y/N flag with the current value. The details themselves need no pulling out by hand: both parties' requisites are merge fields, so the template inserts them the moment they exist on the card; the check's job is to prove they do. If something is empty, the process doesn't generate the document but instead assigns the manager a task with a list of what's missing. Generation by button stays available, but in standardized scenarios the process creates the document itself — after all the checks.
Common problems with templates
A field didn't merge — the code in the template doesn't match the real field code: copy the code from the template page again, don't retype it by hand. The layout broke — a docx with merge fields inside tables and headers/footers is finicky: keep fields in ordinary paragraphs and cells with no nested tables. The wrong seller's requisites — a different My Requisites set is selected in the template: with several legal entities, make a separate template for each. The document number is duplicated — the numerator is shared per template: for separate series (contracts / invoices) use different templates with different numerators.
In summary
A document template is a docx plus data discipline: the business process prepares the values, the completeness check stands before generation, and the formatted dates and calculated amounts are done by robots from the Roboteka catalog — for free, in the same designer. If the conversion you need is missing — describe the task and we'll build the robot.