- Модуль: sender
- Путь к файлу: ~/bitrix/modules/sender/lib/integration/crm/connectors/client.php
- Класс: Bitrix\Sender\Integration\Crm\Connectors\Client
- Вызов: Client::getEntityLimitInfo
public function getEntityLimitInfo(): array
{
$lastContact = \CCrmContact::GetListEx(
['ID' => 'DESC'],
[
'CHECK_PERMISSIONS' => 'N',
'@CATEGORY_ID' => 0,
],
false,
['nTopCount' => '1'],
['ID'],
['limit' => 1]
)->Fetch();
$lastCompany = \CCrmCompany::GetListEx(
['ID' => 'DESC'],
[
'CHECK_PERMISSIONS' => 'N',
'@CATEGORY_ID' => 0,
],
false,
['nTopCount' => '1'],
['ID']
)->Fetch();
$lastContactId = $lastContact['ID'] ?? 0;
$lastCompanyId = $lastCompany['ID'] ?? 0;
return [
'lastContactId' => $lastContactId,
'lastCompanyId' => $lastCompanyId,
'lastId' => max($lastCompanyId, $lastContactId),
];
}