• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/activity/todo.php
  • Класс: Bitrix\Crm\Controller\Activity\ToDo
  • Вызов: ToDo::notifyViaIm
private function notifyViaIm(int $activityId, int $ownerTypeId, int $ownerId, int $responsibleId, int $authorId, int $options = 0): void
{
	if ($options === 0 || !Loader::includeModule('im'))
	{
		return;
	}

	$todo = $this->loadEntity($ownerTypeId, $ownerId, $activityId);
	if (!$todo)
	{
		return;
	}

	[$message, $messageOut] = $this->createNotificationMessages(
		$activityId,
		$ownerTypeId,
		$ownerId,
		trim($todo->getSubject()),
		$options
	);
	if (!isset($message, $messageOut))
	{
		return;
	}

	CIMNotify::Add([
		'MESSAGE_TYPE' => IM_MESSAGE_SYSTEM,
		'NOTIFY_TYPE' => IM_NOTIFY_FROM,
		'NOTIFY_MODULE' => 'crm',
		'TO_USER_ID' =>$responsibleId,
		'FROM_USER_ID' => $authorId,
		'NOTIFY_EVENT' => 'changeAssignedBy',
		'NOTIFY_TAG' => 'CRM|TODO_ACTIVITY|' . $activityId,
		"NOTIFY_MESSAGE" => $message,
		"NOTIFY_MESSAGE_OUT" => $messageOut,
	]);
}