Views: 1052 (Data available since 06.02.2017)

Some activities may suspend the execution of a business process pending user’s response.

For such activities, there is an option to perform tasks instead of the user through API. To do so, send an external event to the workflow as follows:

CBPDocument::SendExternalEvent($workflowId, $activityName, $arEventParameters);

where:

  • $workflowId - the identifier of a business process instance;
  • $activityName - the name of the activity pending an external event;
  • $arEventParameters - an array of parameters necessary for a specific activity.

    Note: Parameters will vary for different activities.
    For more details about the acceptable parameters of a specific activity, please refer to this activity’s source code using the method OnExternalEvent.


Example for the Activity "Document Approval":

CBPDocument::SendExternalEvent("5046fe0fbf1888.64722245","Approve1",array("USER_ID"=>1,"APPROVE"=>true));

where:

  • "5046fe0fbf1888.64722245" - the identifier of a business process instance;
  • "Approve1" - the name of the approval activity;
  • "USER_ID"=>1 - the identifier of the approving user;
  • "APPROVE"=>true - the approval result (if declined - false).


Courses developed by «Bitrix», Inc.