Xrm.Page.getControl("name").setDisabled(true) //锁
Xrm.Page.getControl("name").setDisabled(false) //解锁
//全部锁定和解锁方法
//Disable all fields
function DisableAll() {
Xrm.Page.ui.controls.forEach(function (control) {
var controlType = control.getControlType();
if (controlType != "iframe" && controlType != "webresource" && controlType != "subgrid" && controlType != "searchwidget" && controlType != "kbsearch") {
control.setDisabled(true);
}
});
}
//Enable all fields
function EnableAll() {
Xrm.Page.ui.controls.forEach(function (control) {
var controlType = control.getControlType();
if (controlType != "iframe" && controlType != "webresource" && controlType != "subgrid" && controlType != "searchwidget" && controlType != "kbsearch") {
control.setDisabled(false);
}
});
}