# События (хуки)

Для добавление в отправляемые данные своих данных можно использовать следующие хуки ([подробнее](https://www.hostcms.ru/documentation/modules/core/events/))

<pre class="language-php" data-line-numbers data-full-width="true"><code class="lang-php"><strong>// добавление данных в произвольные поля
</strong><strong>class My_Bitrix
</strong>{
    static public function onBeforeCrmLead($controller, $args)
    {
        $oEntity = $controller->getEntity(); // Shop_Order, Form_Fill
        $actionLead = $args[0]; // add или update
        
        /** $args[1] - параметры,
         * добавление параметров в fields
         */
        $args[1]['fields']['UF_CRM_1467910560'] = array('id' => 60);
    }
}

Core_Event::attach('Bitrix24_Controller.onBeforeCrmLead', array('My_Bitrix', 'onBeforeCrmLead'));
Core_Event::attach('Bitrix24_Controller.onBeforeCrmDeal', array('My_Bitrix', 'onBeforeCrmDeal'));
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.morozovpimnev.ru/bitrix24/sobytiya-khuki.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
