Skip to content

Make form read only using JavaScript in D365 CE

In this blog, we will learn how to make the entire form read-only using JavaScript in D365 CE(CRM).

Code:

var formCustomizations = {
    disableForm: function (executionContext) {
        let formContext = executionContext.getFormContext();

        let formControls = formContext.ui.controls;

        formControls.forEach(element => {
            if (element.getName() != "" && element.getName() != null) {
                element.setDisabled(true);
            }
        });

    }
}

Explanation:

  • Get all the controls of the form and loop through them to make it disable
  • Call your JavaScript function

Result:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments