RE: how fetch the modal window on CRM?
The modal dialog in CRM is an Internal Microsoft dialog, and should not be used for development purposes, since Microsoft might change their internal code base, and the dialog will stop working.
If you still decide to use the dialog (regardless of this), you can call it using the following options:
var DialogOption = new Xrm.DialogOptions;
DialogOption.width = 600; DialogOption.height = 450; // There are other options
Xrm.Internal.openDialog("/WebResources/new_mydialog.html", DialogOption, null, null, myDialogCallback);
Your callback function would look like the following
function myDialogCallback(callbackValue)
{
}
Inside your web resource, if you would like to return values to the script page above:
Add the following to your header:
<script type="text/javascript" src="/_common/ClientGlobalContext.js.aspx"></script>
Add the following to your OK button click:
Mscrm.Utilities.setReturnValue(selectedOption);
closeWindow(true);
Hope this helps.