Friday, December 28, 2012

Set the CRM Form as Read Only


function setFormAsReadOnly() {
    // define the logic here
    disableFormFields(true);
}
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);
        }
    });
}

No comments:

Post a Comment