Hello everyone,
I am at a loss with a recent requirement that I have to download a custom report through the CRM and generate it as a PDF file so it can be sent elsewhere.
I have the ability to create a plugin, web service, or use javascript, but I don't have a direct SSRS report link to use and am told that I must grab the report from CRM in the way it is generated through CRM (Such as going to run Report > and picking the report).
Some of the things I've tried:
1. Added a button to the ribbon bar of the desired entity using the ribbon workbench.
2. Added custom JS to perform an ajax call to a custom webservice that is utilizing the CRM SDK.
3. Attempted to scrape the https://organizationurl/crmreports/viewer/viewer.aspx URL while also passing in the appropriate parameters such as id and record type.
4. Turn the parsed HTML into a PDF document.
This failed because I would only be returned a CRM login page instead of the html containing the actual report.
--------------------
I've also tried coping the following URL: https://community.dynamics.com/crm/f/117/t/205829
and using the example provided by Bharat.
However, with this example, among many others, my report session and controlid always return as some form of:
[L> <html> <head> , HTML> <html> <head> <scr]
Then, when I go to open the PDF file, I get a message from Adobe stating that the file is corrupt, I am assuming it is because I never get a good report session and controlid in the first place.
All of the examples that I can find, such as the one listed above, all mention CRM online. Can anyone confirm if they have seen an approach like this for on-premise, if so, would you mind sharing some insight on what made it work?
I am also open to any other suggestion such as how I may be able to access it with a plugin or webservice.
Thank you,
*This post is locked for comments