2023

One of the most common tasks when integrating CRM Bitrix24 into a company's processes is the task of automatically creating an invoice with the necessary parameters.
Bitrix24 presents a large set of tools for automating routine actions. These are robots and business processes that allow you to describe and automate a significant part of typical actions. Unfortunately, at the moment, there is no action in business processes that allows you to create an invoice.
A client approached us with the task of automating typical processes in the company.
At one stage of the business process of handling incoming orders, an invoice with a set of predetermined parameters should be created.
Given the complex and branched structure of the processes in the company, invoices may be created several times, at different stages, with different input parameters. As a solution we developed the business process module (activity) based on Bitrix24 REST API.
The activity allowed to create invoices with the right set of fields from the business process.
In addition to the obvious advantages, this solution has one disadvantage.
The business process module (activity) itself is static, it is created once, with a predefined set of fields, and does not react to changes in the list of fields on the account.
To keep the list of fields in the activity up to date, we bind to the event of updating the custom fields on the account and synchronize (update) the list of fields in the activity, according to the account.
Unfortunately, you can't simply update an activity using REST API methods - you have to delete and recreate it. In this case, due to changes in the internal activity ID, there may be situations where you need to reconfigure and re-connect it in a business process.
To reduce the number of actions when changing an activity identifier, you can store it in business process constants, then when you change this constant, identifiers will change in all places where activity execution results are used.
Such approach allows to simplify significantly the process of automating the creation of invoices, adjust the necessary business processes of the company and achieve increased accuracy, absence of manual input errors, reduced routine and reduced time spent by managers.