How to set conditional readOnly field for Inline Edit ?

Hello Team,

I want to set conditional based readonly field, I did for record view through - custom/Extension/modules/Accounts/Ext/Dependencies

Please see below sample code which is working fine for record view but not on inline edit

$dependencies['Accounts']['lock_account_fields'] = array(
'hooks' => array("edit"),
'trigger' => 'not(equal($account_type,""))',
'triggerFields' => array('account_type'),
'onload' => true,
'actions' => array(),
);

For inline edit, I have overrided below file and code, but somehow "_validationComplete" function is not triggering.

Pathcustom\modules\Accounts\clients\base\fields\editablelistbutton\editablelistbutton.js

({
extendsFrom:'EditablelistbuttonField',
initialize: function(options) {
   this._super("initialize", [options]);
},
_validationComplete: function(isValid) {
   this._super('_validationComplete',[isValid]);
},
_render: function() {
      this._super('_render');
}
})
Parents Reply Children
  • Ramana Raju Santhana

    As per your suggestion, conditional readonly field is working on record view, but somehow from my side record.js file is not triggering for Inline Edit (ListView), might be I am making some mistake. 

    But I made some adjustment in my previous code and my problem is resolved. I have overrided below file and code 

    Pathcustom\modules\Accounts\clients\base\fields\editablelistbutton\editablelistbutton.js

    ({
    extendsFrom:'EditablelistbuttonField',
    initialize: function(options) {
     this._super("initialize", [options]);
    },
    _loadTemplate: function() {
     this._super('_loadTemplate');

          if( //Custom contion// ) {
           $('[name="phone_office"]').attr('readOnly',true);

          }
    }
    })

    -Shyam