Archive

Archive for August 10, 2011

Disabling form in CRM 2011

Hi,

Here is the Jscript code to disable the CRM Form (i.e., Fields on the form)

function doesControlHaveAttribute(control){

var controlType = control.getControlType();

return controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”;

}

function disableFormFields(truefalse){

Xrm.Page.ui.controls.forEach(function(control, index) {

if (doesControlHaveAttribute(control)){

control.setDisabled(truefalse);

}

});

}

How do I call this?

  • To disable Form  – disableFormFields(true)
  • To Enable Form  –  disableFormFields(false)

Hope it Helps 🙂