Tuesday, November 27, 2012

Disabling all Fields on a Form in CRM 2011(Locking Form for Editing)

Disabling all Fields on a Form in CRM 2011 - Andrew Zimmer - Avtex Blogs for SharePoint, Microsoft CRM, .NET Development, and Infrastructure Services:


"function doesControlHaveAttribute(control) {
    var controlType = control.getControlType();
    return controlType != "iframe" && controlType != "webresource" && controlType != "subgrid";
}

function disableFormFields(onOff) {

    Xrm.Page.ui.controls.forEach(function (control, index) {
        if (doesControlHaveAttribute(control)) {
            control.setDisabled(onOff);
        }
    });
}"

Usage
disableFormFields(true);

No comments:

Post a Comment