In brief
From an existing report to a PDF download.
- This 2020 walkthrough uses JavaScript to download an existing Dynamics 365 SSRS report as a PDF.
- The examples cover obtaining a report session and control ID, then requesting the PDF.
- Report parameters and prefiltering change how the request is constructed.
Originally published in 2020. These examples document the SSRS reporting approach used at the time. Check the reporting interfaces supported by your environment before adapting the code.
There is plenty of material available to achieve this very commonly needed functionality to generate PDF of the existing report in your CRM system. I will give some tips and tricks to achieve this in most efficient way.
The requirement is to download PDF format of the SSRS report (OOB or Custom) on a button click either on home page grid or on a button click on the form.
The process has two steps
Step 1: Get ReportSession and ControlID
Related resource
Code example 1
Step 2: Download the report as a PDF
Related resource
Code example 2
Tips and Tricks
It is very important that you prepare parameter XML and query string correct in order to generate PDF report smoothly. I will show you how you can smoothen this.
- If custom report is generated with report Wizard i.e. enableprefiltering=”1″, then use below example for query string where CRM_Filterednemely_quote is parameter name in the custom report on Quote entity.
Related resource
Code example 3
- If custom report is created without prefiltering, then use below query string where CRM_Filterednemely_quote is parameter name in the custom report on Quote entity.
Related resource
Code example 4
- If custom report and not using fetch as parameter.
Related resource
Code example 5
- To get parameter XML, use fiddler to get all details you need.
Hope this helps to achieve your goal. Please contact us if you have any questions.




