Hooks on contact entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex9999
    Junior Member
    • Jun 2025
    • 1

    #1

    Hooks on contact entity

    Hello,

    I'am currently trying something realy simple yet it does not seems to work properly.
    I am running EspoCRM on version 9.0.8.


    I'm trying to implement a simple beforeFind or could do a beforeSelect hook on the Contact entity, but it is not being triggered. The list view is unaffected and no log entry is created in data/logs.

    $GLOBALS['log']->alert('--- MY CONTACT HOOK IS RUNNING ---'); inside the function

    Created the file /custom/Espo/Custom/Hooks/Contact/ContactHook.php

    added that hook inside the file : /custom/Espo/Custom/Resources/metadata/entityDefs/Contact.json

    "hooks": {
    "beforeFind": [
    "Espo\\Custom\\Hooks\\Contact\\ContactHook"
    ]
    }

    Rebuilded and cleared the cache multiple times.
    But yet the Hook does not seems to be working at all, do you have any other pointers (than permissions) or maybe an alternate method to apply a filter to the contact list if the current user is not admin.

    Thanks a lot for your help !


Working...