это код в init.php
AddEventHandler('form', 'onAfterResultAdd', 'my_onAfterResultAddUpdate');
function my_onAfterResultAddUpdate($WEB_FORM_ID, $RESULT_ID)
{
if ($WEB_FORM_ID == 1){
$arAnswer = CFormResult::GetDataByID(
$RESULT_ID,
array(),
$arResult,
$arAnswer2
);
AddMessage2Log( $arAnswer, 'form1');
$arFields = array();
$arFields["RS_DATE_CREATE"] = $arResult["DATE_CREATE"];
// прикрепляю поля из админки
if ( $arAnswer["SIMPLE_QUESTION_799"][0]["USER_TEXT"] )
$arFields["SIMPLE_QUESTION_799"] = $arAnswer["SIMPLE_QUESTION_799"][0]["USER_TEXT"];
else
$arFields["SIMPLE_QUESTION_799"] = "";
if ( $arAnswer["SIMPLE_QUESTION_206"][0]["USER_TEXT"] )
$arFields["SIMPLE_QUESTION_206"] = $arAnswer["SIMPLE_QUESTION_206"][0]["USER_TEXT"];
else
$arFields["SIMPLE_QUESTION_206"] = "";
if ( $arAnswer["SIMPLE_QUESTION_634"][0]["USER_TEXT"] )
$arFields["SIMPLE_QUESTION_634"] = $arAnswer["SIMPLE_QUESTION_634"][0]["USER_TEXT"];
else
$arFields["SIMPLE_QUESTION_634"] = "";
if ( $arAnswer["SIMPLE_QUESTION_798"][0]["USER_TEXT"] )
$arFields["SIMPLE_QUESTION_798"] = $arAnswer["SIMPLE_QUESTION_798"][0]["USER_TEXT"];
else
$arFields["SIMPLE_QUESTION_798"] = "";
AddMessage2Log( $arFields, 'form1');
// прикрепляю фаил
if ($arAnswer["new_field_file"][0]["USER_FILE_ID"] )
CEvent::Send( "FORM_FILLING_SIMPLE_FORM_1", "s1", $arFields, "N", 25, array($arAnswer["new_field_file"][0]["USER_FILE_ID"] ));
else
CEvent::Send( "FORM_FILLING_SIMPLE_FORM_1", "s1", $arFields, "N", 25);
}
}
}