• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/document.php
  • Класс: CBPDocument
  • Вызов: CBPDocument::startWorkflow
static function startWorkflow($workflowTemplateId, $documentId, $parameters, &$errors, $parentWorkflow = null)
{
	$errors = [];
	$runtime = CBPRuntime::GetRuntime();

	$parameters = static::prepareWorkflowParameters($parameters);

	try
	{
		$wi = $runtime->CreateWorkflow($workflowTemplateId, $documentId, $parameters, $parentWorkflow);
		$wi->Start();
		return $wi->GetInstanceId();
	}
	catch (Exception $e)
	{
		$errors[] = array(
			"code" => $e->getCode(),
			"message" => $e->getMessage(),
			"file" => $e->getFile()." [".$e->getLine()."]"
		);
	}

	return null;
}