Answer the question
In order to leave comments, you need to log in
How to add transaction change event handling in the Bitrix24 box?
The task is: when changing a deal, get a custom field and fill in another custom field based on its data.
In /local/php_interface/init.php I write the following code:
AddEventHandler("crm", "OnAfterCrmDealUpdate", "OnAfterCrmDealUpdateHandler");
function OnAfterCrmDealUpdateHandler(&$arFields)
{
$log = "\n------------------------\n";
$log .= date("Y.m.d G:i:s") . "\n";
$log .= print_r($arFields, 1);
$log .= "\n------------------------\n";
file_put_contents( $_SERVER["DOCUMENT_ROOT"].'/local/php_interface/result.log', $log, FILE_APPEND);
return true;
}
Answer the question
In order to leave comments, you need to log in
Try using the new EventManager entry:
<?php
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandlerCompatible(
'crm',
'OnAfterCrmDealUpdate',
function (&$arFields){
ob_start();
echo PHP_EOL."<pre>".PHP_EOL;
var_dump($arFields);
file_put_contents(__DIR__.'/log.log', ob_get_clean(), FILE_APPEND);
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question