718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

It’s not uncommon when working with large amounts of JavaScript files, whether you’ve created them or are using third party libraries, to run into a dependency issue. It’s a significant enough problem that libraries like RequireJS exist to address it. However, when developing for CRM, coders lose some of the control over the application pipeline that they may typically have when creating custom web applications.


In an effort to improve performance and shave some valuable time off loading of forms, Microsoft modified the loading behavior of JavaScript files in Update Rollup 12 and higher, and in doing so, have created an issue with dependencies between those files. The solutions most likely to be affected by this change are ones that have a lot of interdependencies between libraries and are of a significant size or rely on outbound connections like fetches.

To resolve this, you can write a simple function to determine the availability of your given resources. This is similar to the methods used when working with jQuery in native web applications that utilize the browsers existing methods for checking loaded status. The method is as follows:

function onScriptReady(name, callback) {

var interval = 10;

window.setTimeout(function () {

if (window[name]) {


} else {

window.setTimeout(arguments.callee, interval);


}, interval);


To use, simply find a method that has a dependency, and wrap that function in the onScriptReady function. For instance, given the following script that relies on a global variable:

var aValue = GlobalVariable.prototypedMethod(input);

You could wrap the function like this:

onScriptReady(“GlobalVariable”, function(t){

var aValue = GlobalVariable.prototypedMethod(input);


You can make the function more complex if you like, to handle things like multiple dependencies or check to ensure if a script is being used on a UR 12 or 13 solution or not, but this simple implementation should be good enough for resolving most JavaScript dependency issues in CRM 2011 for UR 12 and beyond.

If this was helpful, you might also want to refer to some of our other blogs on using JavaScript in Dynamics CRM.

Happy CRM’ing!

Avatar for JoeCRM


Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.