How to disable all fields in a form by JavaScript Microsoft Dynamics CRM/365

Avatar
Sep 2, 2019  1 min read

How to disable all fields in a form by JavaScript Microsoft Dynamics CRM/365

The below code disable all fields in a form:

function disableFormFields(formContext) {
    formContext.ui.controls.forEach(function (control, index) {
        var controlType = control.getControlType();
        if (controlType != "webresource" && controlType != "subgrid" && controlType != "iframe") {
            control.setDisabled(true);
        }
    });
}
Comments
Be the first to comment.
Loading...