CRM 2011/2013 – use the debugger console to enabled/disable controls on a form

I was trying to fix a small bug but I was getting bogged down with the business logic (which I didn’t need/want to change) on the form.

The problem was there was lots of business logic which kept disabling the fields I wanted to change.

I tried briefly to understand the business logic but it was complex and detailed and I wasn’t really interested in understanding the form logic and/or briefly amending the JavaScript onload.  All I needed to do was to enable an optionset on the form, which would enable a ribbon button.

So it’s time for a bit of off the cuff hacking

I loaded the form

Press F12 to bring up the debugger window

You can use the console to manipulate the fields and enable/disable certain fields.

You have access to the CRM JavasScript objects

So I used the Xrm.Page, selected the control (not the field attribute) and did a setDisabled(false); which enables the control.
This didn’t enable the ribbon button because although the JavaScript function which is used by the ribbon button (e.g. the enable rule for the Ribbon button) the ribbon hadn’t been refreshed.

So I used the console to do a Ribbon Refresh


Fantastic, now my field was enabled and the ribbon button was enabled and ready to be pressed.


Other uses for F12 JavaScript debugger is to get the guid of the record, which I did on this blog post


Browser bookmark

An alternative to bringing up the F12 debugger is to create a bookmark, this will enable you to pass javascript into a form before loading it.

The blog post below created a God Button, which enables all fields—don-t-let-your-users-see-this


This blog post will talk you through the logic and is the first part in a series of blog posts on the subject


One thought on “CRM 2011/2013 – use the debugger console to enabled/disable controls on a form

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s