Work Hours
8:00 am - 6:00 pm UTC+3
  • Home
  • Blog
  • Implementations
  • Implementation of a document generator in Bitrix24.Embed your own content when exporting Bitrix24 docs to PDF

Artem Shuklin

Anatoly Erofeev

Implementation of a document generator in Bitrix24.Embed your own content when exporting Bitrix24 docs to PDF

In July 2019, a music studio from Germany contacted us to customize their on-premise Bitrix24. They wanted us to implement a feature that allowed product descriptions in PDF invoices to be changed arbitrarily.


To be able to create PDFs, we needed a mechanism for linking CRM entities (transactions and leads, transactions and accounts, accounts and goods, etc.). Mind you, their Bitrix24 CRM is completely in German! There’s a popular saying that goes: Terrified of Wolfen - don’t go to Wald. We weren’t terrified!


Client’s attempt at the customization

Before contacting us, the client had attempted tweaking their Bitrix24 themselves - they altered the product list template using HTML. The result was disastrous!  The HTML markups completely ruined the product display on their entire website. Markup text that should be hidden from visitors of their website became visible.

In addition to this, when they installed an update to their Bitrix24, their customization disappeared -  so they were back to square one. 


They had two options

  1. They either had to spend the same resources they did the first time - tweak an HTML template that would disappear with every update to Bitrix24 and repeat a never-ending cycle  OR 

  2. Contact competent professionals and get proper customization. 

We’re glad they chose the second :)



Action plan

We proposed a more appropriate approach that does not alter the output of goods in the CRM and is compatible with any Bitrix24 update:

  1. Add a new property type for the CRM card: visual editor;

  2. Create a multiple field “Product Description” in the CRM Account;

  3. When creating an Account (or adding new goods to an existing one), copy the original description of the goods into this field;

  4. When generating PDF, replace the original description with the description from the field in the CRM Account;

  5. Repeat the logic for CRM Transactions, Leads and Offers, take into account entity conversion.

Our client was impressed with our proposal. We commenced negotiations immediately and wrote Technical Specifications in English (We are fluent in English).


HTML field

Bitrix24 is a powerful System, but it lacks some features. There’s no “HTML text” property, so we created it.

There were many conflicts between the Javascript visual editor and the CRM card while trying to create and standardize the newly created field. Thanks to our wide expertise and broad experience, we were able to make them compatible. The custom field is displayed correctly on a separate page and in the transaction/Lead pull-out card. 

Initially, we set the descriptions of goods to appear in the same order as the goods on the list. This seemed like a great solution until we noticed that the goods in the invoice were rearranged automatically and randomly (Surprise!). To prevent users (with the same assumptions we had) from making errors, we set a tip (product name)  to be displayed before each description.


Inheriting descriptions from a CRM product card

To get product descriptions from the CRM card of the same product, we used partially documented events of the entities Lead, Transaction, Offer, Account:

  • OnAfterCrm ... Update

  • OnAfterCrm ... ProductRowsSave

Customized descriptions of goods are saved when converting entities (lead-> company) and issuing (transaction -> invoice).


Customization of the PDF generator

This was the most challenging part of the job.

The diagram below is a general scheme of the Bitrix24 “Document Generator” module before our customization:


The onBeforeProcessDocument event, which is initialized immediately after the operation of the built-in data provider, came in handy for us. The processor receives the list of goods, replaces the original descriptions with custom ones and returns the new descriptions to the generator. 

The final scheme of the document generator:

Conclusion

We provided customization that fulfills the requirements of our client, maintains the integrity of their website and simplifies their business processes. We also gained more experience in the internal workings of the Bitrix24 document generator. 

The project was completed on schedule and transferred to the client’s portal without any incident.

Although this customization was small, it was an interesting project. 

INTERVOLGARU is the GOLD-CERTIFIED partner of 1C-Bitrix. We are the best in Bitrix24 integration and customization and have been leaders in sales since 2011.

We have created similar Bitrix24 customizations

An automated designer that generates invoices, acts, notes, and other business documents.

and also integrated several platforms with Bitrix24 - Telephony Asterisk, Quickbooks, Kenya's national portal.


If you would like a unique Bitrix24 portal, tailored to your company’s needs, or a rework of your Bitrix24 portal, Write to us at  info@intervolgaru.com.

  • 26.12.2019