Developing Business Process Templates for Bitrix24
The portal has accumulated eight similar approval processes with minor differences in amounts and approvers. Each was configured separately; when the rules change you have to edit eight copies. BP templates solve this problem — one template, parameters at launch.
What Is a Business Process Template
A template is a saved BP configuration that can be launched for any suitable document. Templates are stored in b_bizproc_workflow_template, bound to a document type (MODULE_ID, ENTITY, DOCUMENT_TYPE).
The key difference from a one-off BP: launch parameters. When starting a template the system shows the user a form with fields — the user enters data (e.g., the amount or reason for the request), and it becomes available inside the process as variables.
Parameters vs. Variables vs. Constants
Three data types in a BP template:
Parameters — requested from the user at launch. Type, required flag, and default value are set in the editor. Used where data changes from run to run.
Variables — internal variables that exist within a single BP instance. Initialized at the start, modified by actions. For example, the variable ApprovalResult accumulates voting results.
Constants — fixed values, identical for all runs of the template: threshold amounts, notification addresses, IDs of approving users. When rules change only the constant is updated — the entire graph doesn't need to be rebuilt.
Export and Import of Templates
Templates are exported to an XML file via the editor interface. The XML contains the full BP structure: all actions, conditions, settings, and field bindings. This allows:
- Moving templates between portals (test → production)
- Storing templates in version control
- Building a library of standard processes
When importing to a new portal, field bindings (user IDs, list IDs) need to be remapped manually — they will differ. There is no automatic remapping.
Import/export path: [List] → Business Processes → [Template] → Edit → Export/Import.
Programmatic Template Creation
For bulk creation of similar templates (e.g., for 30 lists) the API is used:
$template = new \CBPWorkflowTemplateLoader();
$arTemplate = [
'MODULE_ID' => 'lists',
'ENTITY' => 'BizprocDocument',
'DOCUMENT_TYPE' => 'iblock_' . $iblockId,
'NAME' => 'Request Approval',
'DESCRIPTION' => '',
'AUTO_EXECUTE' => \CBPDocumentEventType::Create,
'TEMPLATE' => $arProcessTemplate, // array from XML
'PARAMETERS' => $arParameters,
'VARIABLES' => $arVariables,
'CONSTANTS' => $arConstants,
];
$templateId = \CBPWorkflowTemplateLoader::Add($arTemplate, $errors);
AUTO_EXECUTE — automatic launch flag: on document creation, modification, or manually. Values: 0 (manual), 1 (create), 2 (modify), 4 (delete).
Template Versioning
Bitrix24 has no built-in git-like versioning for BP. Best practice: before every change, export the XML with the date in the filename and store it in a repository. On problems — import the old version.
Development Time
| Task | Time |
|---|---|
| Designing the template structure | 2–4 h |
| Building the template in the editor | 4–8 h |
| Testing and debugging | 2–4 h |
| Documentation for administrators | 2 h |
Developing one template — 2–3 working days including scenario planning and testing on real data.







