1. Full VS intellisense.
2. Ability to set break points (F9). You can’t do that if your code resides in the onload/onsave events.
3. Quick development cycle as oppose to the edit -> save -> publish routine.
4. Don't forget to paste the code back in the onload event if you want this to work offline.
/* This goes in the entity onload event */
//create a new script Element
var script2Load = document.createElement("SCRIPT");
set the src (url) Property with a random number to avoid caching
if you don't set the random number ie will cach your file and you might need to ctrl + f5 to see the changes you make while developing.
script2Load.src = "/ISV/Entity/account.js?nocach=" + Math.random(); //Just an example
//append the element to the head tag (global scope)
/* this goes in the account.js file */
expose the function to the window scope.
This is important if your going to paste the file back into the entity onload event to support offline mode or a redeployment becouse the script is loaded into the head tag (global scope) and the onload event is a third level function which makes the functions you write unavailable to external calls.
window.CallMeFromAnywhare = CallMeFromAnywhare;
/* last Line */