• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_component_helper.php
  • Класс: \CCrmComponentHelper
  • Вызов: CCrmComponentHelper::prepareInitReceiverRepositoryJS
static function prepareInitReceiverRepositoryJS(int $entityTypeId, int $entityId): string
{
	\Bitrix\Main\UI\Extension::load('crm.messagesender');

	$receivers = [];
	if (\CCrmOwnerType::IsDefined($entityTypeId) && $entityId > 0)
	{
		$repo = \Bitrix\Crm\MessageSender\Channel\ChannelRepository::create(
			new \Bitrix\Crm\ItemIdentifier($entityTypeId, $entityId),
		);

		$receivers = $repo->getToList();
	}

	$receiversJson = Main\Web\Json::encode($receivers);

	return <<
BX.ready(() => {
	BX.Crm.MessageSender.ReceiverRepository.onDetailsLoad({$entityTypeId}, {$entityId}, '{$receiversJson}');
});

JS;
}