Documentation

CreateWorkflow

CBPWorkflow
public function CBPRuntime::CreateWorkflow(
 int workflowTemplateId,
 array documentId,
 array workflowParameters = array()
);

This method creates new workflow instance for the specified document. Workflow instance is created based on the workflow template. If required, this method automatically launches the runtime.

This is a low-level method. It's recommended to use CBPDocument::StartWorkflow method.

Method parameters

ParameterDescription
workflowTemplateIdWorkflow template ID
documentIdDocument ID, for which the workflow is launched. It is presented as an array(document_module_code, document_class, document_code) array
workflowParametersArray of parameters to launch a workflow

Returned value

Launched workflow instance is returned.

Exceptions

CodeDescription
workflowTemplateIdWorkflow tempalte ID not specified
EmptyRootActivityFail to create a workflow instance.

See Also

Examples

<?
$runtime = CBPRuntime::GetRuntime();

try
{
$wi = $runtime->CreateWorkflow($workflowTemplateId, $documentId, $arParameters);
$wi->Start();
}
catch (Exception $e)
{
//
}
?>


© «Bitrix24», 2001-2024
Up