I'm need set readOnly in custom field when logged user not admin in record.js
if(app.user.get('type') == 'admin')
  //set readOnly field
else
  //set editable fiel
								I'm need set readOnly in custom field when logged user not admin in record.js
if(app.user.get('type') == 'admin')
  //set readOnly field
else
  //set editable fiel
								You should be able to adapt this Gist to do what you want:
Custom record view controller for setting entire record to read-only conditionally · GitHub
They key is to add the field name into the "noEditFields" array.
You should be able to adapt this Gist to do what you want:
Custom record view controller for setting entire record to read-only conditionally · GitHub
They key is to add the field name into the "noEditFields" array.
Thank you Angel Magana. This is work!
This is code to community
({
  /*  Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
  *   File: ./custom/modules/Opportunities/clients/base/views/record/record.js
  * 
  * Set all fields to read-only conditionally
  */
  extendsFrom: 'RecordView',
  
  _renderHtml: function(){    
      var self = this;
      console.log("LOG: "+app.user.get('type'));
      if(app.user.get('type') != 'admin')  {
        self.noEditFields.push('my_custom_field');
      }
    
    this._super('_renderHtml');
    
  },  
  _dispose: function(){
    this._super('_dispose');
  }
})
Hi Angel Magaña
How can i set Editable 
 Sugarcrm 7.6 if i convert Lead then Status is no editable but i want that can be Edit.
 How can i do ??
Do you know how I could apply this to the Revenue Line Item create subpanel view. So when you are on an Opportunity Create screen and adding Revenue Line items via the subpanel I need to be able to make fields on that view read only or editable based on an on change event.
Hi
 This code works for me in 7.8 when I pause it at breakpoints. However it appears that this javascript is running before the model has been loaded, hence I get
 this.model.attributes.sales_status is undefined
 When I run it without breakpoints.
When I insert a breakpoint and type in the javascript consolethis.model.attributes.sales_status
 It comes up with "Closed Won", but when I haveconsole.log(this.model.attributes.sales_status)
 it just prints undefined.
 Is there a way to make sure this only runs once the model has been fully loaded?
Also is it preferred to set fields to readonly using this method or sugarlogic dependencies?