Wednesday, 20 October 2021

Make form read only using JavaScript in D365 CE

 

Make form read only using JavaScript in D365 CEedIn

WhatsAppFacebookEmailTwitter

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

    }
}

No comments:

Post a Comment

How to Trigger a Microsoft Flow from a Custom Button in Dynamics 365

  When using Microsoft Flow the out-of-the-box button is nested under the ‘Flow’ section and is not easy to find nor is it customizable. Tri...