• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entityrequisite.php
  • Класс: Bitrix\Crm\EntityRequisite
  • Вызов: EntityRequisite::getCountryIdByRequisiteId
public function getCountryIdByRequisiteId($requisiteId)
{
	$countryId = 0;
	$requisiteId = (int)$requisiteId;

	if ($requisiteId > 0)
	{
		$requisite = EntityRequisite::getSingleInstance();
		$res = $requisite->getList(
			[
				'filter' => array(
					'=ID' => $requisiteId
				),
				'select' => ['COUNTRY_ID' => 'PRESET.COUNTRY_ID'],
				'limit' => 1
			]
		);
		if (($row = $res->fetch()) && isset($row['COUNTRY_ID']))
		{
			$countryId = (int)$row['COUNTRY_ID'];
		}
	}

	return $countryId;
}