In order to update a deal in bitrix24, this code can be used:
function OnAfterCrmDealAddHandler(&$arFields) { define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/custom_crm_log.txt"); global $DB; $DB->StartTransaction(); $arUpdateData = array( 'COMMENTS' => "Hello world" ); $deal = new CCrmDeal; if($deal->Update( $arFields['ID'], $arUpdateData, true, true, array('DISABLE_USER_FIELD_CHECK' => true)) ) { AddMessage2Log("Successfully added", "custom_crm"); $DB->Commit(); $arErrors = array(); } else { AddMessage2Log($deal->LAST_ERROR, "custom_crm"); $DB->Rollback(); } }
Comments
Post a Comment