• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/controller/item.php
  • Класс: BitrixRpaControllerItem
  • Вызов: Item::addAction
public function addAction(BitrixRpaModelType $type, array $fields = [], string $eventId = null): ?array
{
	$item = $type->createItem();

	$this->processFields($item, $fields);

	$command = Driver::getInstance()->getFactory()->getAddCommand($item);
	if($eventId)
	{
		$command->setPullEventId($eventId);
	}
	$result = $command->run();
	if($result->isSuccess())
	{
		$item = $command->getItem();

		return [
			'item' => $this->prepareItemData($item),
		];
	}

	$this->deleteUploadedFiles();
	$this->addErrors($result->getErrors());

	return null;
}