CCrmLiveFeedComponent::createContact

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmLiveFeedComponent
  4. createContact
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/livefeed.php
  • Класс: \CCrmLiveFeedComponent
  • Вызов: CCrmLiveFeedComponent::createContact
static function createContact($params)
{
	global $USER;

	$contactId = false;

	if (
		!empty($params['EMAIL'])
		&& check_email($params['EMAIL'], true)
	)
	{
		$CCrmContact = new CCrmContact();

		if (
			empty($params['NAME'])
			&& empty($params['LAST_NAME'])
		)
		{
			$params['LAST_NAME'] = $params['EMAIL'];
		}

		$fields = array(
			'NAME' => (!empty($params['NAME']) ? $params['NAME'] : ''),
			'LAST_NAME' => (!empty($params['LAST_NAME']) ? $params['LAST_NAME'] : ''),
			'FM' => array(
				'EMAIL' => array(
					'n1' => array (
						'VALUE' => $params['EMAIL'],
						'VALUE_TYPE' => 'WORK',
					)
				)
			),
			'TYPE_ID' => 'CLIENT',
			'SOURCE_ID' => 'EMAIL',
			'RESPONSIBLE_ID' => $USER->GetId()
		);

		$contactId = $CCrmContact->Add($fields, true, array('REGISTER_SONET_EVENT' => true, 'DISABLE_USER_FIELD_CHECK' => true));
	}

	return $contactId;
}

Добавить комментарий