Documentation

onAfterResultStatusChange

Description and parameters

handler function(
 int WEB_FORM_ID,
 int RESULT_ID,
 int NEW_STATUS_ID,
 string(1) CHECK_RIGHTS
);
Event handlers are called after updating webform result status. This can be used for any additional notifications via email as well as for replacing webform status handler. Handler is not designed to return any values. You can use CFormResult::SetField() for updating webform result fields.

Parameters

ParameterDescription
WEB_FORM_ID Webform ID.
RESULT_ID Result ID.
NEW_STATUS_ID Status ID.
CHECK_RIGHTS Flag "Check permissions" (Y|N).

See Also

Handler function example

public static function my_onAfterResultStatusChange($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID, $CHECK_RIGHTS)
{
  global $USER;
  
  // handler action applies only to the webform with ID=6
  if ($WEB_FORM_ID == 6) 
  {
    // 1 - "checked" status (by default), 2 - "accepted" status
    // write user ID to hidden field 'status_user', 
    // who updated the status.
    if ($NEW_STATUS_ID == 2)
      CFormResult::SetField($RESULT_ID, 'status_user', $USER->ID);
  }
}

// register function as event handler
AddEventHandler('form', 'onAfterResultStatusChange', 'my_onAfterResultStatusChange');

© «Bitrix24», 2001-2024
Up