Thursday, June 24, 2010

Call External JS file in CRM from OnLoad/OnSave/OnChange event in MS CRM 4.0

Take an example. I have a JS file named “Entity_OnLoad.js” in “ISV/Org_Name/JavaScript” folder. There is a method named “CommonAction” in “Entity_OnLoad.js” file.

With the help of following Jscript we can call the “CommonAction” method from “Entity_OnLoad.js” in the OnLoad/OnSave/OnChange event of the CRM form.


var netRequest = new ActiveXObject("Msxml2.XMLHTTP");
netRequest.open("GET", "/ISV/Org_Name/JavaScript/Entity_OnLoad.js", false);
netRequest.send(null);
eval(netRequest.responseText);

CommonAction();

No comments: