Announcement

Collapse
No announcement yet.

Setting teamsIds is not working under custom Hook

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

  • Setting teamsIds is not working under custom Hook

    Hi, I created a Hook like the following code, everything works except for the teamsIds line, how can I make it work?

    <?php

    namespace Espo\Custom\Hooks\Lead;

    use Espo\ORM\Entity;

    class Schedule extends \Espo\Core\Hooks\Base
    {
    public function beforeSave(Entity $entity, array $options = [])
    {
    if ($entity->isNew() ) {
    $entity ->set('source','Search');
    $entity ->set('teamsIds','5f5118eed104c7de4');

  • #2
    hello,
    it s a array .. not a string like your code

    $entity ->set('teamsIds',[ '5f5118eed104c7de4' ] );

    Comment


    • #3
      thanks, it worked after using your answer and adding

      $entity->loadLinkMultipleField('teams');

      before the actual teamsIds setting.

      Comment

      Working...
      X