Setting up automatic document generation in Bitrix24

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages

Configuring Document Auto-Generation in Bitrix24

A manager prepares a contract: opens last year's file, replaces company name, address, tax ID, amount. Forgets to change the date—the contract says 2024. Sends to client; client notices and asks to fix. Manager corrects; resends—but now there's an error in the details. Manual document completion always means errors, wasted time, and unprofessional appearance. Bitrix24's document generator solves this in seconds.

How Document Generation Works

The crm.documentgenerator module generates documents from templates with CRM data substitution. The mechanics:

  1. A template is created in .docx format with placeholders—special markers like {Company Name}, {Tax ID}, {Deal Amount}.
  2. Manager opens a deal card (or company, contact, invoice) and clicks "Document" → select template.
  3. The system substitutes data from the card into the placeholders and generates a ready file.
  4. The document is saved in the deal timeline and on Bitrix24 Drive.

Creating Templates

A template is a standard .docx file prepared in Word or Google Docs. In needed places, instead of specific data, placeholders are inserted.

Available fields for substitution:

  • Deal — name, amount, stage, creation date, custom fields
  • Company — name, tax ID, registration number, legal address, bank details
  • Contact — name, position, phone, email
  • Line Items — table of products with name, quantity, price, total

For line item tables, special syntax is used: a template row inside the table is duplicated for each deal item.

Typical Templates

Document Data Source Details
Contract Deal + Company Both parties' details, subject, amount
Commercial Proposal Deal + Items Item table with prices
Invoice Deal + Items + Company Payment details, total amount
Services Report Deal + Items List of services, signatures
Specification Deal + Items Technical description

PDF Export

The generator creates .docx, but PDF is often needed for sending to clients. Bitrix24 converts the document to PDF on download or send. For correct conversion:

  • Use standard fonts in the template
  • Avoid complex formatting (nested tables, dynamic headers)
  • Test the result with sample data before production

Automatic Sending

You can send the document to the client directly from Bitrix24—via email from the deal card. For full automation, set up a robot in the deal:

  • Deal moves to "Document Preparation" stage → robot generates contract from template
  • Deal moves to "Invoice Sent" stage → robot generates invoice and sends it to contact's email

The document is attached as a PDF.

Company Details

Your company details are set in CRM settings: CRM → Details. If your company has multiple legal entities, create a separate detail set for each. When generating a document, the manager chooses which legal entity to generate from.

What We Configure

  • Document templates in .docx with placeholders for CRM fields
  • Template binding to deal types and directions
  • Robots for automatic document generation on stage change
  • Auto-sending documents to clients via email
  • Company details and legal entity setup
  • Template testing for correct substitution and PDF conversion