AnsweredAssumed Answered

Set selected_teams (padlock) in Logic Hook

Question asked by Kishor Mali on Dec 20, 2019
Latest reply on Dec 22, 2019 by Kishor Mali

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');
     },
})

Outcomes