Monday, January 10, 2011

How to Load external JS files in MS CRM Form

Some times its really helpful to link the external js files to a form.
It will help you, that you can srite in a file by using VS studio or any js editor.

//create the function which will load the file
function LoadExternalScript(scriptFile)
{
var netRequest = new ActiveXObject("Msxml2.XMLHTTP");
netRequest.open("GET", scriptFile, false);
netRequest.send(null);
eval(netRequest.responseText);
}

//call the above function by passing your file name(absolute path)
LoadExternalScript("/ISV/js/filename.js");
//now call the OnLoad function, which has defined in the external JS file
//also you can define and call other function, in the external JS files
OnLoad();

Have a wonderful coding.

Sudhanshu

No comments:

Post a Comment