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
Parameter | Description |
---|---|
workflowTemplateId | Workflow template ID |
documentId | Document ID, for which the workflow is launched. It is presented as an array(document_module_code, document_class, document_code) array |
workflowParameters | Array of parameters to launch a workflow |
Returned value
Launched workflow instance is returned.
Exceptions
Code | Description |
---|---|
workflowTemplateId | Workflow tempalte ID not specified |
EmptyRootActivity | Fail to create a workflow instance. |
See Also
- CDBResult class
Examples
<?
$runtime = CBPRuntime::GetRuntime();
try
{
$wi = $runtime->CreateWorkflow($workflowTemplateId, $documentId, $arParameters);
$wi->Start();
}
catch (Exception $e)
{
//
}
?>
© «Bitrix24», 2001-2024