I followed the guidelines for espo to add phone other types such as home or office data to also export along with the primary phone data. I created a service for my contact entity in custom/espo/custom/services/Contact.php
Following is the code
<?php namespace Espo\Custom\Services; class Contact extends \Espo\Core\Templates\Services\Person { protected $exportAdditionalFieldList = ['phoneNumberOffice']; public function loadAdditionalFieldsForExport(\Espo\ORM\Entity $entity) { parent::loadAdditionalFieldsForExport($entity); $this->loadPhoneNumberField($entity); } protected function getFieldPhoneNumberOfficeFromEntityForExport(\Espo \ORM\Entity $entity) { $phoneNumberData = $entity->get('phoneNumberData'); foreach ($phoneNumberData as $d) { if ($d->type == 'Office') { return $d->phoneNumber; } } return ''; } } ?>
BUT IT IS NOT WORKING AND STILL IT IS EXPORTING ONLY PRIMARY PHONE VALUE NOT THE OFFICE TYPE ALONGWITH
Following is the code
<?php namespace Espo\Custom\Services; class Contact extends \Espo\Core\Templates\Services\Person { protected $exportAdditionalFieldList = ['phoneNumberOffice']; public function loadAdditionalFieldsForExport(\Espo\ORM\Entity $entity) { parent::loadAdditionalFieldsForExport($entity); $this->loadPhoneNumberField($entity); } protected function getFieldPhoneNumberOfficeFromEntityForExport(\Espo \ORM\Entity $entity) { $phoneNumberData = $entity->get('phoneNumberData'); foreach ($phoneNumberData as $d) { if ($d->type == 'Office') { return $d->phoneNumber; } } return ''; } } ?>
BUT IT IS NOT WORKING AND STILL IT IS EXPORTING ONLY PRIMARY PHONE VALUE NOT THE OFFICE TYPE ALONGWITH