How set readOnly dynamically in record.js?

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

Parents Reply
  • 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');
      }
    
    
    })
    
Children
No Data