Document Generator: Overview of Methods
We are still updating this page
Some data may be missing here — we will fill it in shortly.
Quick navigation: all methods
Currently, there are two scopes for working with the document generator:
- Methods
crm.documentgenerator.*. The results of these methods are displayed in the CRM interface; - Methods
documentgenerator.*. The results of these methods are only available at the REST level.
Data from one scope cannot be accessed from another:
- You cannot create a CRM document with a template for REST;
- You cannot use CRM data when working with methods
documentgenerator.*.
The following field types and their modifiers are supported:
- IMAGE - images;
- STAMP - seals and signatures;
- DATE - dates;
- NAME - names.
The field types Money and Address are implemented within the crm module, so they cannot be used in the REST of this module. If you need to display such data, you will have to pass it in a pre-formed format.
It is possible to use arrays for insertion into tables and repeating blocks.
Differences in Method Parameters Across Scopes
“Internally,” the methods are identical. In fact, the methods crm.documentgenerator.* call the methods documentgenerator.* after preprocessing the parameters. However, there are several differences:
- For the input of methods
crm.documentgenerator.*, you need to pass the ID of the CRM entity type instead of provider names (parameterentityTypeId); - For the input of methods
crm.documentgenerator.*, you need to pass the parameterentityIdinstead of the value parameter - the ID of the CRM entity.
Templates
All templates and documents created by this API are tied to the REST module. You cannot access templates and documents from other modules through the documentgenerator scope. Therefore, the moduleId in the template data will always be rest. Even if you specify another module in add or update, it will not be changed.
Only two providers are available for REST:
Bitrix\DocumentGenerator\DataProvider\Rest- must always be specified as the provider for the templateBitrix\DocumentGenerator\DataProvider\HashDataProvider- used for passing data into tables / repeating blocks
The binding of the template to the user is not considered by the REST methods. However, it can be utilized on the application side.
Numbering
For working with numberers, there are methods documentgenerator.numerator.*, described here. It should be noted that through this scope, you can access all numberers for documents, including those that work in CRM. However, you can only update/delete the numberer that was created through REST.
List of Regions
Each template is tied to a specific country. The list of countries is fixed and currently consists of:
- us - United States
- by - Belarus
- kz - Kazakhstan
- ua - Ukraine
- br - Brazil
- mx - Mexico
- de - Germany
- uk - United Kingdom
- pl - Poland
Starting from version documentgenerator 18.6.1, it became possible to add your own regions. A separate section was created for managing them.
Summary
What can be done?
- Create documents based on templates in .docx file format;
- Insert lists with an arbitrary number of items into the template via tables or repeating blocks;
- Insert images into the template, including from lists;
- Insert fields in HTML format with partial preservation of formatting;
- Create documents, send them, and track views without user involvement (via Automation rules).
What cannot be done?
- Insert multiple values for the file type field;
- Insert tables and images from HTML;
- Insert vector images;
- Formatting transfer is not fully executed.
Overview of Methods and Events
Documents
|
Method |
Description |
|
Creates a new document based on a template |
|
|
Deletes a document |
|
|
Enables/disables a public link to the document |
|
|
Retrieves a list of document fields |
|
|
Retrieves a document by its identifier |
|
|
Retrieves a list of documents |
|
|
Modifies an existing document |
Numbering
|
Method |
Description |
|
Adds a numberer |
|
|
Deletes a numberer |
|
|
Retrieves a numberer by its identifier |
|
|
Retrieves a list of numberers |
|
|
Modifies a numberer |
Regions
|
Method |
Description |
|
Returns information about a region by its identifier |
|
|
Returns a list of regions, both default and custom |
|
|
Deletes a region |
|
|
Adds a new region |
|
|
Updates an existing country |
Roles
|
Method |
Description |
|
Provides information about a role and its access permissions |
|
|
Returns a list of roles without their access permissions |
|
|
Deletes a role |
|
|
Adds a new role |
|
|
Updates roles |
|
|
Sets a set of roles and their bindings |
Templates
|
Method |
Description |
|
Uploads a new document template |
|
|
Updates an existing document template |
|
|
Returns a document template by its identifier |
|
|
Returns a list of document templates by filter |
|
|
Deletes a document template |
|
|
Returns a list of document template fields |