Trigger update on entity when adding a related entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alexS
    Junior Member
    • May 2018
    • 8

    Trigger update on entity when adding a related entity

    Hey guys,

    I have a product entity that can have multiple categories (which are set as related entities).
    Anyone know how can I set an updated flag on the product every time I link a new category?

    Thanks
  • yuri
    Member
    • Mar 2014
    • 8443

    #2
    Hi,

    You need to create a hook (see developer docs) for a product entity type and check whether category is changed.

    $entity->isAttributeChanged('categoryId').
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...