There are two changes that need to be made. The first of them simple:
webform.submissionsinclude_once(drupal_get_path('module', 'webform') .'/webform_submissions.inc');module_load_include('inc', 'webform', 'includes/webform.submissions');hook_form_alter() for modifying the form$form_values, but now use $form_state['values']$form_state['values']['submitted_tree']['facility'] = $facilityid_name; //email $form_state['values']['submitted'][23] = $facilityid_id; // database