string(1) "8"
Document Generator for Cloud Bitrix24
09.11.2017 15:11:00
Articles
8
Document Generator forms files with .docx-extention on the base of the template, created by the user, takes data from CRM.

Quick solution for the template question

row1.png

Many Bitrix clients use the Business Process Designer in their daily work. Template business processes have made work much easier, but the formation of the same files manually after working out the business process still delayed the execution of the task. For example, such standard documents as a commercial offer or contract had to be filled manually with duplicate data — company names, employee names, requisites, etc.

Target

row2.png

It was necessary to develop a solution that allows to automate the formation of template files by substituting data from business processes. When creating a document, which contains, for example, company data, you have to fill in a lot of fields — name, details, etc. Doing this manually each time is long, and there is a high probability of making an error when copying data. Therefore, we needed a solution that allows you to transfer data directly from the CRM to the final file.

Result

row4.png

As result, we have developed a new activity for the Business Process Designer — "Document Generator", which generates a file with the extension .docx based on the template, created by the user, and sample data like details, names are automatically inserted into the template fields after launch of business process.

Installation

1. Choose the solution on the Marketplace.

2. Click Install, specify the path for installation.

3. After installation a new activity will appear in the Business Process Designer — Document Generator.

Attention! If your tariff doesn’t have a Business Process Designer (Project and Project + tariffs), the solution will not be installed.

Principle of operation (example)

To work with the Generator, you have to create a template file with the .docx extension. A template may contain any text with the formatting you need, and it has also contain fields of Merge Field type with given variable names for data substitution.

You can add fields of Merge Field type this way: click the Insert tab, select Express Blocks - Field. Select the type Merge Field and enter the name of the field (this is the name of the variable).

en2.jpg

Save the template. Then you have to download it to the system. Go to the Drive menu, select the folder for the template, and load your template file there.

en2.jpg

en3.jpg

Note the ID field next to the loaded template. It will be used in the Generator settings.If the ID column is hidden, enable it in the settings. 

en6.jpg

Also create a folder to save the result file after running the Document Generator, and remember its ID.

en5.jpg

After downloading the template, you can proceed to work with business processes. For example, we will create a template business process for the company in CRM.

At any point in the business process chain, add the Document Generator (from the Application Actions tab).

en4.jpg

Open the Generator settings. In the settings are prescribed fields, from which data will be taken to be substituted into the variables of the template fields.

en_settings.jpg

Let's look at the settings fields:

  • Title — the name of this activity. This is especially relevant if there are several of Generators in the chain of the business process. In this case, the created files with the result will have different names that you set in the settings of each activity; 

  • ID of the template (integer) — ID of the file with .docx extention, which was downloaded as a template file in the system; 

  • ID of the folder — ID of the folder to save the resulting file (integer); 

  • Name of file — format of the resulting file, foe example: KP_{=System:Date} — in this case, the name of the file will contain letters KP, underscore and the current date (if the file with this name already exists, the result will not be saved);

  • Label — name of the variable in the template file. If there are few fields of type Merge Field, click Add button and fill in the names of other variables; 

  • Text for label — the name of field, from which will be taken data for substitution. If you have markered few labels, for each you have to specify the “Text for label” field. You can choose the data field for substitution from the list - click on the button with three dots.

  • Run as - on behalf of which users run the business process. 

After filling all the fields of the Generator, click the "Save" button. Then, save the changes made to the business process (button below).

Starting a business process

After you have determined all the settings for the Generator, you have to start the business process, with which the file generation will be linked. In our example, the business process is performed on company data, so we select any company from the list and launch our business process for it.

en7.jpg

After running the business process, the resulting file can be easily downloaded from the folder you specified in the settings, printed or sent by e-mail.

en8.jpg

The resulting file completely saves the formatting you specified.

en9.jpg

Conclusion

row5.png

Significantly reduced the time of drawing up documents! Also, the human factor is excluded, since it is easy to make a mistake when filling out a multitude of similar documents. And when data is taken automatically from the system, it is excluded. M. C. Art knows how to make your work more effective!

 

comments powered by Disqus