Remove Global Team from all the modules

Hello Everyone,

I am working on SugarCRM Enterprise, Version 9.2.0-dev.1 (Build 120) (Fall '19).

I have to remove Global team from all the records which I have in SugarCRM all modules.

Earlier I was thinking about deleting team id of Global Team (i.e. 1) from team_sets_teams table. But it sounds bad idea.

Because, Global team may be the primary team of any record so $bean->team_id contains the id of Global team.

Currently I don't have any idea how to deal with this. Any help is highly appreciated.


  • Hi Kishor Mali,

    In your case just managing the $bean->team_id is not enough. Whenever teams change there $bean->team_set_id is also changed. 

  • If you will delete the ID of Global then it will also create the problem regardless it is already used as a primary or secondary team in the record.

  • Hi Maryam Aslam,

    Thanks for the quick reply.

    The same thing I was thinking about. For example.

    Delete all occurrences of Global Team from team_sets_teams table.

    UPDATE team_sets_teams SET deleted = 1 WHERE team_id = '1'

    Set all team_id as blank in module table.

    UPDATE accounts SET team_id = '' WHERE id = '934e6d46-xxxx-xxxx-xxxx-00155d640fc2'.

    But this not did the trick.

    I am still receiving response like this.

        "id": "934e6d46-xxxx-xxxx-xxxx-00155d640fc2",
        "date_modified": "2020-02-07T17:36:47+05:30",
        "annual_revenue": "",
        "locked_fields": [],
        "team_name": [
                "id": "1",
                "name": "Global",
                "name_2": "",
                "primary": false,
                "selected": false
                "id": "40ba2fd6-xxxx-xxxx-xxxx-00155d640fc2",
                "name": "Team B",
                "name_2": "",
                "primary": false,
                "selected": false
        "_acl": {
            "fields": {}
        "_erased_fields": [],
        "_module": "Accounts"

    Anything I am missing here?

    Do we have any other and better approach than this? Always welcome.

  • Hi Kishor Mali,

    As I mentioned already that only updating the team_id will not enough. You will also need to update the test_set_id as well. So by using:

    UPDATE accounts SET team_set_id = '' WHERE id = '934e6d46-xxxx-xxxx-xxxx-00155d640fc2'.

    You will get no data in the team_name array.

    But it will remove other teams as well. Can you share with me your case that why you want to remove the Global team? Because if it is truly compulsory then you will need some extra work.

    First, you will need to find the team_set_id of the record.

    Then you will need to find which teams lie in this team set id.

    After removing Global you will need to assign another team_set_id which will unique and will contain all teams except the Global team.