function OnOnBeforeEventAdd(&$event, &$lid, &$arFields, &$message_id, &$files){
    if ($event == 'ololo_form_event') {		
        $isFiltered = false;
		$by="s_id";
		$order="desc";
		/// код совойства в которм должны быть файлы
		$arFilterField = Array(
			"SID"	=> "FILE_CODE_QUESTION"
		);
		$rsQuestions = CFormField::GetList(
			$arFields['RS_FORM_ID'], 
			"N", 
			$by, 
			$order, 
			$arFilterField, 
			$isFiltered
		);
		if($isFiltered){		
			if ($arQuestion = $rsQuestions->Fetch()){
				$arFilterAnswer = Array(
					"FIELD_TYPE" => "file",
				);
				$rsAnswers = CFormAnswer::GetList(
					$arQuestion['ID'], 
					$by, 
					$order, 
					$arFilterAnswer, 
					$isFiltered
				);
				if($isFiltered){
					while ($arAnswer = $rsAnswers->Fetch()){
						$file = CFormResult::GetFileByAnswerID($arFields['RS_RESULT_ID'], $arAnswer['ID']);
						if(intval($file['USER_FILE_ID']) > 0){
							$files[] = $file['USER_FILE_ID'];
						}
					}						
				}					
			}				
		}
        return $arFields;
    }
}