Announcement

Collapse
No announcement yet.

Account and emailAddressData, beforeSave not triggered

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Account and emailAddressData, beforeSave not triggered

    Hello,

    I have a hook for Account entity that updates a field based on it's email addresses using beforeSave method.
    It is working fine when saving Account in full edit mode. But if I use quick save for email addresses only, it is not working.
    I think the beforeSave method is not triggered at all. Is there some way to trigger it or some other method ?

    My hook is located at
    custom/Espo/Custom/Hooks/Account

    And the field is the standard emailAddress

  • #2
    Okay, actually it is triggered.

    I guess the problem is actually that emaill address changes are not saved yet?

    I use this code to get them:
    $emails = $entityManager->getRepository('EmailAddress')->getEmailAddressData($entity);

    Comment


    • #3
      I think I found a solution!

      I moved it to from beforeSave to afterSave method and then use this command:
      $this->getEntityManager()->saveEntity($entity, array('skipWorkflow' => true, 'skipHooks' => true));

      Now that makes me wonder if skipAll would be better than these two.

      Comment

      Working...
      X