Views: 10099
Last Modified: 16.09.2014

It cannot be done through the business process designer interface. API queries must be generated.

  • Go to the administrative part of the system, to the page with the documents for which a new business process template must be created.
  • Go to the page with business processes and create a sequential business process using the business process designer.
  • Add the activity PHP code (section Other) to the template.

As a part of this activity a more complex business process, e.g. Two-stage Approval, can be called from standard business process templates.

  • Open the dialog of activity parameter settings using the icon .
  • Introduce the following code:
    CBPDocument::StartWorkflow(
    6,
    array("iblock","CIBlockDocument","{=Document:ID}"),
    array("Voters"=>array("user_1")));

which is submitted to the method that creates the business process:

  • The first parameter is the ID of the launched template of the business process (in our example, it is a Two-stage Approval)
  • The second parameter contains parameters of the document for which the business process is being created. Here, the fact that the business process will be available in the administrative part and the variable {=Document:ID} are set.
  • The last, third, parameter is an array of parameters of the business process launched. In our case, this is the user who is the addressee of the document. In our example, it is the website administrator.


Courses developed by Bitrix24