Last active
August 1, 2021 12:01
-
-
Save BedrosovaYulia/4f837a1101b74d61fac323a30fc56f05 to your computer and use it in GitHub Desktop.
Lead responsible history events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$eventManager = \Bitrix\Main\EventManager::getInstance(); | |
//--------------------CRM---------------------------------- | |
$eventManager->addEventHandler('crm','OnAfterCrmLeadAdd',function(&$arFields) | |
{ | |
GsResponsibleHistory::Add('LEAD', $arFields['ID'], $arFields['ASSIGNED_BY_ID']); | |
}); | |
$eventManager->addEventHandler('crm','OnBeforeCrmLeadUpdate',function(&$arFields) | |
{ | |
GsFieldsSync::CheckLeadUpdate($arFields); | |
}); | |
$eventManager->addEventHandler('crm','OnAfterCrmLeadUpdate',function(&$arFields) | |
{ | |
$fields = GsFieldsSync::GetLeadUpdateFields(); | |
if($fields['ASSIGNED_BY_ID']) | |
{ | |
if(intval($arFields['ASSIGNED_BY_ID'])>0 && intval($arFields['ID'])>0) | |
{ | |
GsResponsibleHistory::Add('LEAD', $arFields['ID'], $arFields['ASSIGNED_BY_ID']); | |
} | |
} | |
}); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment