Saturday, July 26, 2008

Replacing CRM alert() with a Custom page

if you’re looking for a way to replace the JavaScript alert() function with something more appealing then you have come to the right place.

Integrate the following code inside each entity onload event (supported) or put it inside the global.js file (unsupported) The global.js resides in the “_static\common\scripts\ “ folder.

alert = function( message ) {
var features = “[Modal Dialog Features]”;
var url = “/” + ORG_UNIQUE_NAME + “/isv/appVD/alert.aspx?msg=” + escape(message);
window.openModalDialog( url , window , [FEATURES] );

Replace the [FEATURES] place holder with proper settings.
Replace the appVD with your application Virtual directory name.

Inside the alert.aspx page render the message as follows:

<title>Information Dialog</title>

You can add more QueryString Parameters like imagetype or implement your own report error button if you’re planning an ISV solution.

No comments: