AnsweredAssumed Answered

How can I set team via custom entrypoint for user

Question asked by Autchara Chaiprom on Apr 29, 2017
Latest reply on May 5, 2017 by hats

Hi,

 

I cannot set team via custom entrypoint but it work in logic hook or I do something wrong ?.

 

Ref: http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/Architecture/Teams/Manipulating_Team… 

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

//Retrieve the bean
$bean = BeanFactory::getBean('Users', $record_id);
$bean->load_relationship('teams');
   
//Set the primary team
$bean->team_id = $primary_team;

//Replace the teams
$bean->teams->replace(
   array(
      $primary_team,
      $secondary_team
   )
);
//Save to update primary team
$bean->save();

 

Please suggest me,

Sugar 7.7 Pro

Thank you

M

Outcomes