SugarCRM: Get members of a team

sugarcrmdevelopers —  April 18, 2013

This post will teach you how to fetch all members of a specific team in sugar. You can do this by using the get_team_members function. Look at the example below:

// include Team class
include_once('modules/Teams/Team.php');

$team = new Team();
$team->retrieve('<ID OF THE TEAM>');
$team_members = $team->get_team_members(true);

// Loop through the list
foreach($team_members as $user) {
     // your code here ....
}