JavaScript Upgrade Strategy #8: Eliminate Single-call Methods

When your Dynamics CRM 4.0 JavaScript is converted to the Dynamics CRM 2011 object model, all of the events are consolidated into a single web resource that may look something like this:

 

image

 

As you can see from each of the OnChange events above, you can end up with a situation where all the OnChange event function does it to call another function.  This is actually a waste of time and JavaScript.

Instead of calling an OnChange function, which calls another function, we can just eliminate the OnChange funcation altogether.

We end up with a configuration that looks like this:

 

image

 

And all of the JavaScript shown the first figure can be removed.

After consolidating my JavaScript into the appropriate libraries, as discussed in previous strategies, I have actually ended up with entities that have very little, sometimes no, actual JavaScript in their main library.

And again, JavaScript that is not written does not have to be maintained.

Leave a Reply