Views: 5809
Last Modified: 12.02.2021

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 business process as follows:

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

where:

  • $workflowId - identifier for a business process instance;
  • $activityName - name for the activity pending an external event;
  • $arEventParameters - an array with 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" - name for the approval activity;
  • "USER_ID"=>1 - identifier for the approving user;
  • "APPROVE"=>true - the approval result (if declined - false).


Courses developed by «Bitrix», Inc.