diff --git a/application/Espo/Core/ORM/Entity.php b/application/Espo/Core/ORM/Entity.php index f9b289912f..0786fac195 100644 --- a/application/Espo/Core/ORM/Entity.php +++ b/application/Espo/Core/ORM/Entity.php @@ -52,7 +52,13 @@ class Entity extends \Espo\ORM\Entity if (!$this->entityManager->hasRepository($parentType)) return; $repository = $this->entityManager->getRepository($parentType); - $foreignEntity = $repository->select(['id', 'name'])->where(['id' => $parentId])->findOne(); + $select = ['id', 'name']; + if ($parentType === 'Lead') { + $select[] = 'accountName'; + $select[] = 'emailAddress'; + $select[] = 'phoneNumber'; + } + $foreignEntity = $repository->select($select)->where(['id' => $parentId])->findOne(); if ($foreignEntity) { $this->set($field . 'Name', $foreignEntity->get('name')); }