Posts Tagged ‘Disable fields’

Disabling form in CRM 2011


Here is the Jscript code to disable the CRM Form (i.e., Fields on the form)

function doesControlHaveAttribute(control){

var controlType = control.getControlType();

return controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”;


function disableFormFields(truefalse){

Xrm.Page.ui.controls.forEach(function(control, index) {

if (doesControlHaveAttribute(control)){





How do I call this?

  • To disable Form  – disableFormFields(true)
  • To Enable Form  –  disableFormFields(false)

Hope it Helps 🙂

Disabled fields in Bulk Edit Form – CRM 2011

August 8, 2011 3 comments


In CRM, We can edit multiple records (i.e., Bulk Edit) at a time. To do bulk edits we have to follow below steps

  • Select multiple records from the view (or) Associated view
  • Click on “Edit” button on the Ribbon

– In CRM 4.0 and older UR’s of CRM 2011, once you get the Bulk Edit CRM Form, you would notice couple of fields on the form is in disabled state and you wonder why?


  • Fields with “onchange” event will be in disabled state on Bulk Edit Form in CRM 4.0 and older roll up’s of CRM 2011.
  • With latest UR’s of CRM 2011, by default fields are in enabled state however the scripts associated to fields onchange event are disabled.
  • This is because for multiple records, CRM won’t be able to trigger the OnChange event and take the defined action in OnChange Jscript
  • In simple words, By Default Form and field events are disabled for the bulk edit form.

To enable a field (event) in Bulk Edit Form:-

We can enable the field onchange event by changing entity customization


  • Export the entity as a solution
  • Open “customizations.xml” file using visual studio
  • Navigate to <events> node of the field and set “BehaviorInBulkEditForm” to “Enabled”
  • Import back the solution (See below for the node)
  • <events><eventname=onchangeapplication=falseactive=falseattribute=“{your_attributename}BehaviorInBulkEditForm=Enabled>
  • “BehaviorInBulkEditForm” has below 3 options
    • Enabled  –  If you use this value, the field is enabled. Additionally, the code for the event is run when the event is called.
    • Disabled – If you use this value, the field is disabled.
    • EnabledButNoRender – If you use this value, the field is enabled. However, the code for the event is not run when the event is called.
  • Refer this useful link (KB) on Bulk Edit

Hope it Helps 🙂