Friday, August 24, 2012

Set the CRM Form as Read Only in MS CRM 2011


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);
        }
    });
}

2 comments:

sam fisher said...

thanks for this tip ,its working perfect,similar informations can be found at Microsoft Dynamics CRM

sam fisher said...

nice site for CRM . Microsoft Dynamics CRM