Saturday, 7 September 2013

Opeing a dialog and report using java script

With Update Rollup 12 and the December 2012 Service Update, you can create a JavaScript function to open the dialog as shown in the following example:
function openDialogProcess(dialogId,entityName,objectId)
{
var url = Xrm.Page.context.getClientUrl() + "/cs/dialog/rundialog.aspx?DialogId=" +
dialogId + "&EntityName=" + entityName + "&ObjectId=" + objectId;
window.open(url);
} 
 
And one can open report using below java script
 
  function getReportURL(action,fileName,id) {
   var orgUrl = GetGlobalContext().getClientUrl();
   var reportUrl = orgUrl + 
    "/crmreports/viewer/viewer.aspx?action=" +
    encodeURIComponent(action) +
    "&helpID=" +
    encodeURIComponent(fileName) +
    "&id=%7b" +
    encodeURIComponent(id) +
    "%7d";
   return reportUrl;
  }

 

No comments:

Post a Comment