How to disable all fields on the form through Jscript?

There are many occasions where you need to disable all fields/controls on an entity form. Here is the code snippet that shows how to do that.

// JScript source code
function DisableFieldOnHold() {
if (Xrm.Page.getAttribute(“statuscode”).getValue() == “2”) {
function disableFields() {
var attributes =;
for (var i in attributes) {
if (Xrm.Page.getAttribute(“statuscode”).getValue() != “2”) {
function enableFields() {
var attributes =;
for (var i in attributes) {

**For CRM 2011 Training, please check out our CRM Training page. Please share |Like in Facebook if you feel like this page is useful.

About the Author Dynatecon Solutions

DYNATECON is a group of dynamic professionals who are passionate about building affordable IT solutions using Dynamics 365 and Power platform. We focus on enabling digital transformation in Small scale as well as Medium scale industries. Whether you have 1 user or 100 users and planning to implement a new CRM system, please contact us at We can guide you for sure!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s