Sunday, June 12, 2011

Linking Common JS file (External JS file) in ms crm 2011

We all have experience of reusing codes.
same also happnes in JS codes using.
In ms crm 4.0 we can do it
link1
and Link 2

But in MS CRM 2011, we can do it in more easy way as the Web resource Concept.
Just create a webresource as the external JS file.

1. Suppose i have a test entity. so on the onload of the test, we can write
function _onload(){
alert("hello world!!! inside test entity");
//now call the function of the external js, which has been loaded as webresource
externalCall();
}
2. now the External.js file will be like
function externalCall(){
alert("Inside External JS file");
}
3. here we have to add the External.js in the Form properties of Test entity as well.
4. Now add the event handler of onload of the form to the _onload function

here you go.

No comments:

Post a Comment