• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/restservice.php
  • Класс: BitrixBizprocRestService
  • Вызов: RestService::terminateWorkflow
static function terminateWorkflow($params, $n, $server)
{
	self::checkAdminPermissions();
	$params = array_change_key_case($params, CASE_UPPER);

	if (empty($params['ID']))
	{
		throw new RestException('Empty workflow instance ID', self::ERROR_WRONG_WORKFLOW_ID);
	}

	$id = $params['ID'];
	$status = isset($params['STATUS']) ? (string)$params['STATUS'] : '';
	$errors = [];

	if (!CBPDocument::terminateWorkflow($id, [], $errors, $status))
	{
		throw new RestException($errors[0]['message']);
	}

	return true;
}