Announcement

Collapse
No announcement yet.

Get email address of related\linked Contact from a Custom Enity

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

  • Get email address of related\linked Contact from a Custom Enity

    i have a beforeSave hook for a custom entity i called , Areportingr. (No problem)

    Areportingr has a many to one relationship with Contacts entity.



    How can I get the emailaddress (Contacts) of an instance of a Areportingr and Contacts relationship?


    My hook does not run when i insert the following block of code:

    if (!$foreign->get('emailAddress')) {

    }else{
    $desctemp=$entity->get('description');
    $entity->set("description", $desctemp);
    }


    the following is my hook definition:
    public function beforeSave(Entity $entity, $foreign, array $options = array()){
    ....


  • #2
    are you sure about arguments? beforeSave method has other 2nd param


    you need afterRelate hook and https://www.espocrm.com/documentatio...t-find-related

    Comment


    • Lanket
      Lanket commented
      Editing a comment
      Hello Tanya.
      You give link to "find-ralated"

      There is "$opportunityList = $entityManager->getRepository('Account')->findRelated($account, 'opportunities');"

      What mast have var $account ?
Working...
X