• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entitymanagefacility.php
  • Класс: Bitrix\Crm\EntityManageFacility
  • Вызов: EntityManageFacility::registerLead
public function registerLead(array &$fields, $updateSearch = true, $options = array())
{
	$this->registeredId = null;
	$this->registeredTypeId = \CCrmOwnerType::Lead;
	$this->isBpRun = false;

	if ($this->canAddLead())
	{
		$this->registeredId = $this->addLead($fields, $updateSearch, $options);
		$complex = $this->convertLead($this->registeredId);
		if ($complex)
		{
			$this->registeredTypeId = $complex->getTypeId();
			$this->registeredId = $complex->getId();
		}
		else
		{
			$this->registeredEntities->addIdentificator(
				$this->registeredTypeId,
				$this->registeredId,
				true
			);
		}
	}
	elseif ($this->canUpdate())
	{
		$this->updateClientFields($fields, true, $updateSearch, $options);
	}

	if ($this->isAutomationRun)
	{
		$this->runAutomation();
	}

	return !empty($this->registeredId);
}