Hello. Help please.
I need take field value from relayted OneToOne entity.
I try this :
-------
$var = $entity->get('originalLead.vkuserid');
-------
But this not work
I have Lead converted to Opportunity, and in custom hook i want take field vale from Lead.
Construction "originalLead.vkuserid" i take from formula and i phink what that mast work, but $var if empty. But in this time field value from Lead "vkuserid" is not empty.
Help please.
full code custom hook
<?
namespace Espo\Custom\Hooks\Opportunity;
use Espo\ORM\Entity;
class UnsubscribeSenler extends \Espo\Core\Hooks\Base
{
public function beforeSave(Entity $entity, array $options = array())
{
// originalLead
if ($entity->get('stage') == 'Prepay') {
//if (!is_null($entity->get('Lead.vkuserid'))) {
$entity->set("name", $entity->get("name") . " - " . $entity->get('originalLead.vkuserid'));
//}
}
else {
$entity->set("name", $entity->get("name") . " + ");
}
}
}
I need take field value from relayted OneToOne entity.
I try this :
-------
$var = $entity->get('originalLead.vkuserid');
-------
But this not work
I have Lead converted to Opportunity, and in custom hook i want take field vale from Lead.
Construction "originalLead.vkuserid" i take from formula and i phink what that mast work, but $var if empty. But in this time field value from Lead "vkuserid" is not empty.
Help please.
full code custom hook
<?
namespace Espo\Custom\Hooks\Opportunity;
use Espo\ORM\Entity;
class UnsubscribeSenler extends \Espo\Core\Hooks\Base
{
public function beforeSave(Entity $entity, array $options = array())
{
// originalLead
if ($entity->get('stage') == 'Prepay') {
//if (!is_null($entity->get('Lead.vkuserid'))) {
$entity->set("name", $entity->get("name") . " - " . $entity->get('originalLead.vkuserid'));
//}
}
else {
$entity->set("name", $entity->get("name") . " + ");
}
}
}
Comment