by eggsurplus

Control what your users can access and save time, money, and frustrations. Lock down sensitive data in SugarCRM or SuiteCRM to specific groups or teams. Supports unlimited assigned users, unlimited group assignments to records, custom layouts for each group, login/sudo capabilities and much more.

Free 30 day trial
Try it Now

#327 - Get all members of a team/security group

Closed General Question created by robcollyer Verified Purchase 6 years ago

Hi I want to do something like this where i get all the members of a security group that is associated with an opportunity. is this possible with security suite?

maybe using something like the get_team_members function. Look at the example below:

// include Team class

$team = new Team();
$team_members = $team->get_team_members(true);

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

  1. eggsurplus member avatar

    eggsurplus Provider Affiliate

    6 years ago

    Hey Rob,

    To get the members of a group:


    $group = new SecurityGroup();
    $members = $group->getMembers(); //returns an array of arrays
    foreach($members as $user) {
    //do your stuff here

    To get the groups associated to an opportunity:
    $rel_name = 'SecurityGroups'; //use the link name...can find in cache/modules/{MODULE}/{MODULE}vardefs.php
    $group_ids = $opportunity->$rel_name->get();
    if(count($group_ids)>0) {
        foreach($group_ids as $id) {

  2. douglas.mcloughlan member avatar

    robcollyer Verified Purchase

    6 years ago

    cheers dude, just what i wanted.

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
  • "This impressive add on is easy to use, extremely flexible, and huge time saver. This add on exceeded our expectations and is worth every penny!"

    Read More Reviews

Keep up to date on the latest additions

We'll send you an email every month with handpicked add-ons, reviews, tricks and tips. Don't worry, we hate spam as much as you do.