Good day everyone,
somehow I was able to create popup notifications after lead was assigned to user
this is how it looks
but I have stuck with editing this popup, can someone explain how to make it render some text value inside instead of endDate (which is now None).
I have made Reminder {"customizable":true}, added field Message, but it obviously was not rendered in popup
somehow I was able to create popup notifications after lead was assigned to user
PHP Code:
<?php
namespace Espo\Custom\Hooks\Lead;
use Espo\Core\Utils\DateTime as DateTimeUtil;
use Espo\ORM\EntityManager;
use Espo\ORM\Entity;
use Espo\Core\Hook\Hook\AfterSave;
use Espo\ORM\Repository\Option\SaveOptions;
class Notification implements AfterSave
{
private EntityManager $entityManager;
public function __construct(EntityManager $entityManager)
{
$this->entityManager = $entityManager;
}
public function afterSave(Entity $entity, SaveOptions $options): void
{
$user_id = $entity->get('assignedUserId');
if($user_id){
$notification = $this->entityManager->createEntity('Notification', [
'data' => [
'entityId' => $entity->get('id'),
'entityName' => $entity->get('name'),
'entityType' => 'Lead',
'userId' => 'system',
'userName' => 'System',
],
'type' => 'Assign',
'read' => false,
'emailIsProcessed' => false,
'message' => 'Lead assigned',
'userId' => $entity->get('assignedUserId'),
'relatedId' => $entity->get('id'),
'relatedType' => 'Lead',
]);
$popup = $this->entityManager->createEntity('Reminder', [
'remindAt' => date(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT),
'startAt' => date(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT),
'type' => 'Popup',
'entityId' => $entity->get('id'),
'entityType' => 'Lead',
'userId' => $entity->get('assignedUserId'),
]);
}
}
}
but I have stuck with editing this popup, can someone explain how to make it render some text value inside instead of endDate (which is now None).
I have made Reminder {"customizable":true}, added field Message, but it obviously was not rendered in popup
Comment