locked
Run OOB/System reports from JavaScript for Dynamics CRM online RRS feed

  • Question

  • Hi experts, Following javascript function used to get report ReportSession & ControlID. I have tested this for SSRS reports (custom reports), works fine.

    var reportName ="Account Overview";
    
    function getReportingSession(reportID) {      
        var pth = Xrm.Page.context.getClientUrl() + "/CRMReports/rsviewer/QuirksReportViewer.aspx";  
        var retrieveEntityReq = new XMLHttpRequest();
        retrieveEntityReq.open("POST", pth, false);
        retrieveEntityReq.setRequestHeader("Accept", "*/*");
        retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     
        rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" +
                        reportName + "&isScheduledReport=false";
     
        retrieveEntityReq.send(rptPathString);
     
     
        var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
        var y = retrieveEntityReq.responseText.indexOf("ControlID=");
        var ret = new Array();
        if (retrieveEntityReq.responseText.indexOf("&", x) != -1 && retrieveEntityReq.responseText.indexOf("&", y) != -1) {
            ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14);
            ret[1] = retrieveEntityReq.responseText.substr(y + 10, retrieveEntityReq.responseText.indexOf("&", y) - y - 10);
        }
        else if (retrieveEntityReq.responseText.indexOf("\\u0026", x) != -1 && retrieveEntityReq.responseText.indexOf("\\u0026", y) != -1) {
            ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("\\u0026", x) - x - 14); //the session id     
            ret[1] = retrieveEntityReq.responseText.substr(y + 10, retrieveEntityReq.responseText.indexOf("\\u0026", y) - y - 10); //the control id      
        }
        return ret;
    }

    I need to run this for OOB/system report.I have Tested this for OOB (system reports) reports, but failed.
     
    Kindly post if some one know about getting ReportSession & ControlID for OOB/system reports through JavaScript.
    --Already tried to set iscustomreport=false in above function getReportingSession()
     
    Thanks



    Monday, February 16, 2015 12:42 PM

All replies

  • Hello - I am having the exact same issue trying to retrieve an OOB Quote report from D365 Online. Do you have any updates on this? Thank you in advanced. 
    Thursday, October 12, 2017 5:41 PM