So, I am trying to setup a beforeRead hook but it isn't working correctly.
I just want to update my status field from "Unread" to "Read" once the record has been opened but after I refresh the list view the status field is changed back to "Unread"
List api returns a "Unread" status but the record api gives the status "Read"
This is my hook:
Any tips?
I just want to update my status field from "Unread" to "Read" once the record has been opened but after I refresh the list view the status field is changed back to "Unread"
List api returns a "Unread" status but the record api gives the status "Read"
This is my hook:
Code:
<?php
namespace Espo\Custom\Hooks\WhatsApp;
use Espo\ORM\Entity;
use Espo\Core\Record\ReadParams;
use Espo\Core\Record\Hook\ReadHook;
class HasBeenRead implements ReadHook
{
public function process(Entity $entity, ReadParams $params): void
{
$entity->set('status', 'Read');
}
}

Comment