Google Anlatics

Thursday, October 24, 2013

Model Dialog Open in JavaScript with CRM 2011

//Model Dialog Open in JavaScript with CRM 2011
function Convert() {
var dialogId = "40249148-E8AB-4774-8E68-747C35C70D02";
if (dialogId != null) {
var dialogID = "%7b" + dialogId + "%7d";
var entityName = Xrm.Page.data.entity.getEntityName();
var recordId = Xrm.Page.data.entity.getId();
var width = "550px";
var height = "400px";
LoadProcessDialog(dialogID, entityName, recordId, width, height);
}
}
function LoadProcessDialog(dialogID, entityName, recordId, width, height) {
var context = Xrm.Page.context;
var sUrl = window.parent.location.href;
sUrl = sUrl.substring(0, sUrl.indexOf('/main.aspx'));
var fullUrl = sUrl + "/cs/dialog/rundialog.aspx?DialogId=" + dialogID + "&EntityName=" +
entityName + "&ObjectId=" + recordId;
ShowPopUpWindow(fullUrl, "newWindow", width, height);
}
function ShowPopUpWindow(url, title, w, h) {
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var targetWin = window.showModalDialog(url, title, 'unadorned:yes;resizable:1; dialogHeight:' + h + ';dialogwidth:' + w + ';scroll:no;status=no');
window.document.location.reload(true);
}
//Please make sure not use like below.It will not set heigh and with based on provided prameters.
var targetWin =
window.showModalDialog(url, title,
'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
view raw gistfile1.js hosted with ❤ by GitHub

No comments:

Sri Lanka .NET 
                Forum Member