• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/controller/task.php
  • Класс: BitrixRpaControllerTask
  • Вызов: Task::deleteAction
public function deleteAction($typeId, $stageId, $robotName, string $eventId = '')
{
	$isRobotDeleted = false;
	$documentType = BitrixRpaIntegrationBizprocDocumentItem::makeComplexType($typeId);
	$template = new BitrixBizprocAutomationEngineTemplate($documentType, $stageId);

	$robots = [];

	foreach ($template->getRobots() as $robot)
	{
		if ($robotName !== $robot->getName())
		{
			$robots[] = $robot;
		}
		else
		{
			$isRobotDeleted = true;
		}
	}

	if($isRobotDeleted)
	{
		$tplUser = new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser);
		$result = $template->save($robots, $tplUser->getId());

		if($result->isSuccess())
		{
			Driver::getInstance()->getPullManager()->sendRobotDeletedEvent($typeId, $stageId, $robotName, $eventId);
		}
	}

	return true;
}