- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/timeline/logmessageentry.php
- Класс: Bitrix\Crm\Timeline\LogMessageEntry
- Вызов: LogMessageEntry::create
static function create(array $params)
{
[$authorId, $created, $settings, $bindings] = self::fetchParams($params);
$entityTypeId = self::fetchEntityTypeId($params);
$entityId = self::fetchEntityId($params);
$categoryId = self::fetchCategoryId($params);
$result = TimelineTable::add([
'TYPE_ID' => TimelineType::LOG_MESSAGE,
'TYPE_CATEGORY_ID' => $categoryId,
'CREATED' => $created,
'AUTHOR_ID' => $authorId,
'SETTINGS' => $settings,
'SOURCE_ID' => $params['SOURCE_ID'] ?? '',
'ASSOCIATED_ENTITY_TYPE_ID' => $params['ASSOCIATED_ENTITY_TYPE_ID'] ?? $entityTypeId,
'ASSOCIATED_ENTITY_ID' => $params['ASSOCIATED_ENTITY_ID'] ?? $entityId,
]);
if (!$result->isSuccess())
{
return 0;
}
$createdId = $result->getId();
if (empty($bindings))
{
$bindings[] = ['ENTITY_TYPE_ID' => $entityTypeId, 'ENTITY_ID' => $entityId];
}
self::registerBindings($createdId, $bindings);
if ($entityTypeId === CCrmOwnerType::Activity)
{
self::buildSearchContent($createdId);
}
return $createdId;
}