Set selected_teams (padlock) in Logic Hook

Hello All,

I am working on 

SugarCRM Enterprise, Version 9.0.2 (Build 191) (Spring '19)

I can set padlock (which is used for teams with special access: O&ST) from record.js but I want to set it from hook.

I want to achieve same functionality from before_save logic hook. Anybody having any idea?

Help highly appreciated.

I done with following code in record.js 

({

    extendsFrom: 'RecordView',

    initialize: function (options) {
        this._super('initialize', [options]);
    },
     
     handleSave: function() {
          
          var selected_team = this.model.attributes.custom_status_c;
          
          var ele = new Array();
          
          this.model.attributes.team_name.forEach(function(element, index){
               if(element.name == selected_team){
                    element.selected = true;
               } else {
                    element.selected = false;
               }
               ele.push(element);
          });
          
          this.model.set('team_name', ele);          
          
          this._super('handleSave');
     },
})
Parents
  • This is my code for adding teams, I use constants to hold the IDs of the teams.

    $teamSetBean = new TeamSet();
    $relatedTeams = $teamSetBean->getTeams($accessBean->team_set_id);
    $teams_arr = array_keys($relatedTeams);
    $teams_arr[] = IT_TEAM;
    $teams_arr[] = CRM_ADMIN_TEAM;
    $taskBean->load_relationship('teams');
    $taskBean->team_id = $accessBean->team_id;
    $taskBean->teams->replace(array_unique($teams_arr));
    $taskBean->save(false);
Reply
  • This is my code for adding teams, I use constants to hold the IDs of the teams.

    $teamSetBean = new TeamSet();
    $relatedTeams = $teamSetBean->getTeams($accessBean->team_set_id);
    $teams_arr = array_keys($relatedTeams);
    $teams_arr[] = IT_TEAM;
    $teams_arr[] = CRM_ADMIN_TEAM;
    $taskBean->load_relationship('teams');
    $taskBean->team_id = $accessBean->team_id;
    $taskBean->teams->replace(array_unique($teams_arr));
    $taskBean->save(false);
Children
No Data