Saturday, July 7, 2012

CRM2011 Set a field to read only

Since I am not a programmer or developer, I always save some frequently used jscript and solutions in my toolbox for quick reference.  Today, I converted one of my CRM4 frequently used jscript and saved to my CRM2011 toolbox. The jscript is to set a field read only.

For CRM4, the jscript is like this:

crmForm.all.new_fieldname.disabled=true;

For CRM2011, the jscript is like this:

Xrm.Page.getAttribute("new_fieldname").controls.get(0).setDisabled(true);