Many thanks
i will try it out.
best regards,
Announcement
Collapse
No announcement yet.
How to notify a given user from within a Hook class
Collapse
X
-
I used github search: https://github.com/espocrm/espocrm/s...q=Notification. And found https://github.com/espocrm/espocrm/b...ocess.php#L114
PHP Code:
use Espo\Entities\Notification;
// ...
$notification = $this->entityManager->getNewEntity(Notification::ENTITY_TYPE);
$notification
->setType(Notification::TYPE_MESSAGE)
->setMessage($message)
->setUserId($userId);
$this->entityManager->saveEntity($notification);
Last edited by yuri; 04-14-2022, 05:56 PM.
Leave a comment:
-
How to notify a given user from within a Hook class
i have some custom hooks for account entity and it involves finding related entities, e.g i have a custom entity called Contract (One Account Has Many Contracts) in my hook i try to find all related contracts for the account but i want to notify the user if no contract has been found. i would just like to use built in notification to notify the user. how can i achieve this? anyone has used the notification before?
yuri can you please help. how can i use the notification within a php class (Hooks)?
Thanks
Leave a comment: