Documentation

onDeleteUserFieldValues

Parameters

Parameter Description Available from version
string entityId Entity string-identifier (for example, UF_USR for user)
int $id Entity ID (for example, user ID)

Return value

Returned value is similar to the value returned by the event [link=6684369]onUpdateUserFieldValues[/link]

Example

\Bitrix\Main\EventManager::getInstance()->addEventHandler('main', 'onDeleteUserFieldValues', function(\Bitrix\Main\Event $event)
{
   $resultType = \Bitrix\Main\EventResult::UNDEFINED;

   $entityId = $event->getParameter('entityId');
   $id = $event->getParameter('id');

   if($entityId === 'UF_MY_ENTITY')
   {
      //delete data
      $result = \MyModule\Model\SomeStorageTable::delete($id);
      if($result->isSuccess())
      {
         $resultType = \Bitrix\Main\EventResult::SUCCESS;
      }
      else
      {
         $resultType = \Bitrix\Main\EventResult::ERROR;
      }
   }

   return new \Bitrix\Main\EventResult($resultType);
});


© «Bitrix24», 2001-2024
Up