posted by aqshakirzhan on December 18, 2023

use Bitrix\Main\Loader;
use Bitrix\Tasks\Internals\TaskTable;
use \Bitrix\Crm\Timeline\Entity\TimelineTable;
Loader::IncludeModule('crm');

//получение истории аналогично вкладке история

$res = CCrmEvent::GetListEx(
['ID' => 'DESC'],
[
'CHECK_PERMISSIONS' => 'N',
'ENTITY_TYPE' => \CCrmOwnerType::DealName,
'ENTITY_ID' => 27069,
]
);
while ($row = $res->Fetch()) {
var_dump($row);
}

// получение истории изменения статусов сделки

var_dump(\Bitrix\Crm\History\DealStageHistoryEntry::getAll(27069));

// получение истории из timeline


$items = TimelineTable::getList(
array(
'select' => array('*'),
'filter' => array(
'ASSOCIATED_ENTITY_ID' => 27069,
'ASSOCIATED_ENTITY_TYPE_ID' => \CCrmOwnerType::Deal,
),
'order' => ['ID' => 'DESC']
)
);
while ($row = $items->fetch()) {
var_dump($row);
}

 

Leave a Comment

Fields with * are required.