Setting teamsIds is not working under custom Hook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mzam1
    Junior Member
    • Sep 2020
    • 2

    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');
  • item
    Active Community Member
    • Mar 2017
    • 1476

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

    $entity ->set('teamsIds',[ '5f5118eed104c7de4' ] );
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • mzam1
      Junior Member
      • Sep 2020
      • 2

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

      $entity->loadLinkMultipleField('teams');

      before the actual teamsIds setting.

      Comment

      Working...