M
M
masterit152018-12-24 17:58:57
Bitrix24
masterit15, 2018-12-24 17:58:57

How to get a comment on a lead in the boxed version of bitrix24?

Good day to all, the task is to get the left comment to the lead in the timeline, how can this be implemented so that the code can be used in the business process? Just did not find anything in the search, the documentation also does not say anything, thanks in advance !!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Sharifyanov, 2019-07-05
@masterit15

To find a comment:

\Bitrix\Main\Loader::includeModule('crm');

$rs = Bitrix\Crm\Timeline\Entity\TimelineTable::getList(array(
  'order' => array("ID" => "DESC"), 
  'filter' => array('=TYPE_ID' => 7),
'select'=>array("ID", "BINDINGS")
));
while($ar = $rs->Fetch()) 
{
   echo '<pre>';
   print_r($ar);
   echo '</pre>';
}

Array
(
   [ID] => 1537
   [CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_OWNER_ID] => 1537
   [CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_ENTITY_TYPE_ID] => 1
   [CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_ENTITY_ID] => 134
   [CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_IS_FIXED] => 
)

ENTITY_TYPE_ID is taken from CCrmOwnerType, for example, \CCrmOwnerType::Lead
ENTITY_ID - the actual lead / deal ID / where-there-you can leave comments
OWNER_ID - this is the ID that we need for the next request
$rs = Bitrix\Crm\Timeline\Entity\TimelineTable::getList(array(
   'order' => array("ID" => "DESC"), 
   'filter' => array('=TYPE_ID' => 7)
));
while($ar = $rs->Fetch()) 
{
   echo '<pre>';
   print_r($ar);
   echo '</pre>';
}

Array
(
    [ID] => 263472
    [TYPE_ID] => 7
    [TYPE_CATEGORY_ID] => 0
    [CREATED] => Bitrix\Main\Type\DateTime Object
        (
            [value:protected] => DateTime Object
                (
                    [date] => 2019-03-18 15:26:16.000000
                    [timezone_type] => 3
                    [timezone] => Europe/Moscow
                )

        )

    [AUTHOR_ID] => 14
    [ASSOCIATED_ENTITY_ID] => 0
    [ASSOCIATED_ENTITY_TYPE_ID] => 0
    [COMMENT] => повторное обращение
    [SETTINGS] => Array
        (
            [HAS_FILES] => N
        )

)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question