Typical use-cases and scenarios of the document generator: case overview

If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.

A template in the document generator is a .docx file with placeholders for fields that are replaced with data from the request when creating the document. Placeholders are formatted in curly braces, such as {DocumentNumber} or {MyField}. For more details, refer to the article Document Generator Templates: Overview of Methods.

The cases help prepare data for document creation based on the template using the documentgenerator.document.add method. After creating the document, you can obtain links to the files and continue working with the results using methods from the Document Generator: Overview of Methods section.

Quick navigation: all cases

Getting Started

  1. Prepare a .docx template with field placeholders.
  2. Retrieve the field map of the template using the documentgenerator.template.getfields method.
  3. Determine which data needs to be passed in values and fields for the documentgenerator.document.add method.
    • values — what to insert into the document.
    • fields — how to interpret this data: field type, format, image, print, table, or repeating block.
  4. Open the example that is closest to your scenario and adapt it to your template.

Case Overview

Case

Description

Generate a document with text

Inserts text values without additional field type settings

Generate a document with date and name modifiers

Formats date and name through DATE and NAME field types

Generate a document with tabular data

Fills rows of a single table with a repeating structure

Generate a document with complex tables

Works with nested tables and multiple repeating blocks

Generate a document with images and seals

Inserts images, seals, and signatures via external links