Return to Snippet

Revision: 58309
at July 7, 2012 00:10 by toLL


Initial Code
function launchModalDialog(dialogId, typeName, recordId)
{
	// Server Url
	var serverUrl = Xrm.Page.context.getServerUrl();
	
	// Sanitize RecordId
	recordId = recordId.replace("{", "");
	recordId = recordId.replace("}", "");
	
	// Sanitize DialogId
	dialogId = dialogId.replace("{", "");
	dialogId = dialogId.replace("}", "");
	
	// Create Url
	var serverUri = serverUrl + '/cs/dialog/rundialog.aspx';
	var dialogUri =  serverUri + '?DialogId=%7b' + dialogId.toUpperCase() +'%7d&EntityName=' + typeName + '&ObjectId=%7b' + recordId + '%7d';

	window.showModalDialog(dialogUri);

	// Reload form
	window.location.reload(true);
}

Initial URL

                                

Initial Description
How to launch custom dialog from JavaScript (for example from custom RibbonButton)

Initial Title
CRM 2011: Launch Dialog from JavaScript

Initial Tags
javascript

Initial Language
JavaScript