Tuesday, December 1, 2009

Adding JavaScript file as Source in MS CRM

All of we know how it is tedious to write js code in MS CRM.
We can include the js files in each entities as it used to be done in html,jsp,aspx etc files.

//create a script element
var script = document.createElement("script");
//set the language to janscript [optional]
script.language = "javascript";
//set the source of the js file with relative or absolute path
script.src = "http://PositiveEdge/js/Sample.js";
//finally add the script element to the head
document.getElementsByTagName("head")[0].appendChild(script);

1 comment:

  1. where should i use this code in form load.
    i have given my own js it is not working.

    ReplyDelete