Solving the error of importing business processes with custom activities in Bitrix24 by Avivi
28 November 2022next article
Our company is often approached by clients who have the same problem with custom activities. This is a fairly common phenomenon after the introduction of additional functionality in the cloud service and on-premise version of Bitrix24, when developers use Rest API methods. It is not easy to find solutions for this bug in Google. But we have such a good development experience for Bitrix24 that we have already found out the reason and found a universal solution for importing a custom activity (a set of basic methods that are necessary for any activity. Can or should be overridden in the inheriting class).
Next, we share exclusively our own experience, gained and tested in practice many times. If the solution helps you too, we will be happy to tell you some more important details or solve the problem of your Bitrix24. So we have a template backup. We import it and get "Import error" in response. The thought creeps in that maybe there is something in the templates that ties it to the Portal or a specific application. Let's take a look at this template.
We open it in any editor, we see something like this:
Everything is coded and it is absolutely impossible to work with such data. Therefore, the first thing you need to understand is how export or import works. Let's look at the template processing page in Bitrix24 on-premise:
The bitrix component is placed here: crm.config.bp. We start editing: we find the bitrix component call there: crm.config.bp.edit, then bizproc.workflow.edit. Templates are imported and exported using the CBPWorkflowTemplateLoader :: ImportTemplate and CBPWorkflowTemplateLoader :: ExportTemplate methods, respectively. Now it becomes painfully clear what was encrypted and how to deal with it. After studying them, we understand what kind of gills they were and how to process our templates now.
To open the template, read its contents: use gzuncompress() and then unserialize(). Now we have an array with a complete description of all activities of our business-process:
For the keyword rest, we define arrays of descriptions of our custom:
We perform the same operations with the exported template from the current version of CRM, or rather, from the place where it is not possible to import the business process. We find the description of rest activity, look at the differences:
In addition to [Type], there is also [Name] in the field, but as practice shows, [Type] is quite enough. We change it to the value of the new template everywhere we meet. We carry out the reverse procedure: we apply serialize() and gzcompress() to the final array, we get a new template that is now successfully imported. Now, you can effortlessly transfer the business processes we need from one CRM to another.
Don't forget to share the article with a familiar Bitrix24 developer or integrator :)
The customization of the Bitrix24 box edition helps where the capabilities of the standard functionality end or go against the preferences of the customer. The Avivi company realized a complex project on implementing restrictions for retail users. This ensured the effectiveness of work processes within the business as well as guarantees the security of its members to resist the competition.
What is the best way to explain the use of Bitrix24 in the company without limiting itself to the words “for everything”? Indeed, this software has so many useful features that you can talk about it for hours. But we will try to make it as short and understandable as possible in this article, based not only on common phrases from the official description, but also on many years of experience and our own vision of the situation.
When choosing a particular product for ourselves, we, of course, think about its demand for other people. This also applies to Bitrix24 CRM: who uses the system, whether it is popular in the Europe, America or Asia, whether the project will close, are normal questions that customers may have. In this article, we will try to paint the big picture. And to tell about what many do not guess.
We will reach out to within 10 minutes