Can a logic hook invoke admin rights?

The Assigned To field in our clients module is set to Read Only for the sales agent role because we don't want the agents to be able to change that field at all.  What I need to do is find a way during the creation of a new client to run a hook - or part of a hook - as the admin user to set the Assigned To field to the agent creating the new client.  Is this possible?

Thanks.

Jason

Parents Reply Children
  • No problem.

    There are about 3 - 4 different ways to do this, but perhaps the easiest and least intrusive would be to simply create a custom controller for your RecordView.

    Create a file called record.js and put the following code in it:

    ({
      extendsFrom: 'RecordView',
    
      initialize: function(options){
      this._super('initialize', [options]);
      this.model.fields['assigned_user_name']['readonly'] = true;
      }
    
    })
    

    Save the file to ./custom/modules/Accounts/clients/base/views/record/, purge the contents of ./cache and reload Sugar. That should do it.