Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Unable to download .rdl Report as PDF on button click

Posted on by Microsoft Employee

Hi everyone,

I developed on SSRS Report and in want to generate PDF on Button Click..!

I am using following JAVASCRIPT   to download the PDF

function getReportingSession()
{
var selectedIds = Xrm.Page.data.entity.getId();
var reportName = "ComplaintsAcknowledgementReport.rdl";
var reportGuid = "124AC837-B9D9-E711-812A-005056A068F3";

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");

retrieveEntityReq.send("id=" + reportGuid + "&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" + reportName + "&isScheduledReport=false&p:parameterNamespecified in ssrs report=" + selectedIds);

var x = retrieveEntityReq.responseText.lastIndexOf("ReportSession=");
var y = retrieveEntityReq.responseText.lastIndexOf("ControlID=");

var ret = new Array();

ret[0] = retrieveEntityReq.responseText.substr(x + 14, 24);
ret[1] = retrieveEntityReq.responseText.substr(x + 10, 32);

return ret;
}
function runReportToPrint()
{ debugger;

var params = getReportingSession();

var newPth = Xrm.Page.context.getClientUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] + "&OpType=Export&FileName=public&ContentDisposition=OnlyHtmlInline&Format=PDF";

window.open(newPth);
}

i got the following error

Capture12.PNG

Please help me on this .....!

Thanks & Regards,

Sreekanth.

*This post is locked for comments

  • Suggested answer
    Iswarya Profile Picture
    Iswarya 1,345 on at
    RE: Unable to download .rdl Report as PDF on button click

    HI,

    when debug what responseText did u get?

  • Suggested answer
    Iswarya Profile Picture
    Iswarya 1,345 on at
    RE: Unable to download .rdl Report as PDF on button click

    Hi,

    yes like syed said follow bharat instructions.

    =>Create new simple report

    =>After try to download your report

  • Suggested answer
    Syed Ibrahim Profile Picture
    Syed Ibrahim 6,257 on at
    RE: Unable to download .rdl Report as PDF on button click

    Pls follow Bharat instructions step by step, it helps

    community.dynamics.com/.../205829

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans