- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/timeline/bizproccontroller.php
- Класс: Bitrix\Crm\Timeline\BizprocController
- Вызов: BizprocController::onActivityError
public function onActivityError(\CBPActivity $activity, $userId, $errorText)
{
[$entityTypeName, $entityId] = explode('_', $activity->GetDocumentId()[2]);
$entityTypeId = \CCrmOwnerType::ResolveID($entityTypeName);
$historyEntryID = BizprocEntry::create(
[
'AUTHOR_ID' => $userId,
'SETTINGS' => [
'TYPE' => 'ACTIVITY_ERROR',
'WORKFLOW_ID' => $activity->GetWorkflowInstanceId(),
'ACTIVITY_TITLE' => $activity->Title,
'ERROR_TEXT' => $errorText
],
'BINDINGS' => [
[
'ENTITY_TYPE_ID' => $entityTypeId,
'ENTITY_ID' => $entityId
]
]
]
);
$enableHistoryPush = $historyEntryID > 0;
if ($enableHistoryPush && Main\Loader::includeModule('pull'))
{
$pushParams = [];
if ($enableHistoryPush)
{
$historyFields = TimelineEntry::getByID($historyEntryID);
if (is_array($historyFields))
{
$pushParams['HISTORY_ITEM'] = $this->prepareHistoryDataModel(
$historyFields,
['ENABLE_USER_INFO' => true]
);
}
}
$tag = TimelineEntry::prepareEntityPushTag($entityTypeId, $entityId);
\CPullWatch::AddToStack(
$tag,
[
'module_id' => 'crm',
'command' => 'timeline_bizproc_status',
'params' => array_merge($pushParams, ['TAG' => $tag]),
]
);
}
}