AnsweredAssumed Answered

Problem with Array of current user's team

Question asked by Richard Coleman on Dec 5, 2014
Latest reply on Dec 8, 2014 by Richard Coleman
Hello. I'm running 6.5.8 Enterprise, and I'm trying to return all of the teams a user is a member of.

I'm going to put this into a field and call it with dependencies, but that's later on.

I'm quite stuck where I'm trying to output the array returned from get_teams_for_user. I should at least get the IDs of "Technical" and "Global". When I run the below, I just get an error saying my Object of type Team can't be converted to a string.

The below is my code in the Controller on my Campaigns object. Any ideas?

<?php require_once('include/MVC/Controller/SugarController.php'); 
require_once('modules/Teams/Team.php');

class CampaignsController extends SugarController{


    function action_editview() { 

  global $current_user;
  $user_id = $current_user->id;
  $objTeams = new Team();
  $teams = $objTeams->get_teams_for_user($user_id);
  $field = $this->bean->name;
  $field = implode(',',$teamArray);
  $this->view = 'edit'; 
    }
}
?>

Outcomes