• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/components/itemdetail.php
  • Класс: BitrixRpaComponentsItemDetail
  • Вызов: ItemDetail::prepareEditorResult
protected function prepareEditorResult(Result $commandResult): ?array
{
	if(!$commandResult->isSuccess())
	{
		$result = null;
		foreach($commandResult->getErrors() as $error)
		{
			if($error->getCode() === Command::ERROR_CODE_MANDATORY_FIELD_EMPTY)
			{
				//					if(!is_array($result))
				//					{
				//						$result = [
				//							'CHECK_ERRORS' => [],
				//						];
				//					}
				//					$data = $error->getCustomData();
				//					$result['CHECK_ERRORS'][$data['fieldName']] = $error->getMessage();
				$this->errorCollection[] = $error;
			}
			else
			{
				$this->errorCollection[] = $error;
			}
		}

		return $result;
	}

	$controller = new BitrixRpaControllerItem();

	return [
		'ENTITY_DATA' => $this->prepareFormData(),
		'SUCCESS' => 'Y',
		'ENTITY_ID' => $this->item->getId(),
		'item' => $controller->prepareItemData($this->item, [
			'withDisplay' => true,
			'withTasks' => true,
			'withUsers' => true,
		]),
	];
}