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.

Cancel at any time!
Free Trial

#573 - Assign Records

Closed General Question created by joaninhafonseca Verified Purchase 5 years ago


I'm trying to add a functionality to SugarCRM using the Securty Suite. I want to add automatically the teams when i create a case, and for that, this support page was very helpful as i used part of the code that i saw in another post:

$securityTeam = new SecurityGroup();
$securityTeam->retrieve_by_string_fields(array('name' => $field_securityGroup ));


The problem is that i don't know the name of the team, i just know the id of the user that belongs to the teams i want to add.
I know that i can do this with a query to the securitygroups_users table, but i want to do this without doing queries to provide a better performance.

There are another way i can do this?

Thanks in advance for your help!


Joana Lopes da Fonseca

  1. eggsurplus member avatar

    eggsurplus Provider Affiliate

    5 years ago

    Which teams do you want to automatically add? If you want those that are related to the user SecuritySuite already does that out of the box. With the Inherit from Created By or Inherit from Assigned User it will grab all teams for that user and associate it to any newly created case.

    If you want a specific team to always be added to any newly created Case you can even set default teams for each module on the SecuritySuite Settings page.

    To your question about grabbing teams for a user, there is a function in SecurityGroup.php called getUserSecurityGroups(). Just pass the user ID and you'll get all teams for that user.

    Hope that helps!

  2. eggsurplus member avatar

    eggsurplus Provider Affiliate

    5 years ago

    I know you've figured this out, but for anyone else who runs into it and who doesn't want to have to use code to do it you can now assign groups automatically when you create or edit a record (plus many other scenarios) using Process Manager. Here is a tutorial on how to do that:


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.