function setup()
 {
     $this->related_module = 'Teams';
     $this->value_name = 'team_set_id_values';
     $this->vardef['name'] = $this->name;
     if (!empty($GLOBALS['beanList'][$this->module_dir])) {
         $class = $GLOBALS['beanList'][$this->module_dir];
         if (SugarAutoLoader::fileExists($GLOBALS['beanFiles'][$class])) {
             $this->bean = BeanFactory::getBean($this->module_dir);
             $secondaries = array();
             $primary = false;
             $this->bean->{$this->value_name} = array('role_field' => 'team_name');
             if (!empty($this->team_id)) {
                 $this->bean->team_id = $this->team_id;
                 if (!empty($this->team_set_id)) {
                     $this->bean->team_set_id = $this->team_set_id;
                 }
             } else {
                 if (!empty($_REQUEST['record'])) {
                     $this->bean->retrieve($_REQUEST['record']);
                 }
             }
             if (!empty($this->bean->team_set_id)) {
                 require_once 'modules/Teams/TeamSetManager.php';
                 $teams = TeamSetManager::getTeamsFromSet($this->bean->team_set_id);
                 foreach ($teams as $row) {
                     if (empty($primary) && $this->bean->team_id == $row['id']) {
                         $this->bean->{$this->value_name} = array_merge($this->bean->{$this->value_name}, array('primary' => array('id' => $row['id'], 'name' => $row['display_name'])));
                         $primary = true;
                     } else {
                         $secondaries['secondaries'][] = array('id' => $row['id'], 'name' => $row['display_name']);
                     }
                 }
                 //foreach
             } elseif (!empty($this->bean->team_id)) {
                 //since the team_set_id is not set, but the team_id is.
                 $focus = BeanFactory::getBean('Teams', $this->bean->team_id);
                 $display_name = Team::getDisplayName($focus->name, $focus->name_2);
                 $this->bean->{$this->value_name} = array_merge($this->bean->{$this->value_name}, array('primary' => array('id' => $focus->id, 'name' => $display_name)));
             } elseif (empty($this->bean->team_id) && empty($this->bean->team_set_id)) {
                 require_once 'include/SugarFields/Fields/Teamset/SugarFieldTeamset.php';
                 $teams = SugarFieldTeamset::getTeamsFromRequest($this->bean->{$this->value_name}['role_field'], $_POST);
                 $primary_id = SugarFieldTeamset::getPrimaryTeamidFromRequest($this->bean->{$this->value_name}['role_field'], $_POST);
                 foreach ($teams as $id => $name) {
                     // getting strings of values is needed because some problems appears when compare '1' and md5 value which begins from '1'
                     if (strval($primary_id) === strval($id)) {
                         $this->bean->{$this->value_name} = array_merge($this->bean->{$this->value_name}, array('primary' => array('id' => $id, 'name' => $name)));
                     } else {
                         $secondaries['secondaries'][] = array('id' => $id, 'name' => $name);
                     }
                 }
             }
             $this->bean->{$this->value_name} = array_merge($this->bean->{$this->value_name}, $secondaries);
         }
     }
     $this->skipModuleQuickSearch = true;
     $this->showSelectButton = false;
 }