0
votes

I am trying to read data from a custom report in CRM Online through the API.

I have no problem fetching data like competitors, accounts using

OrganizationService.RetrieveMultiple()

But when it comes to custom reports, I can't find a way. The report I would like to read is found in the CRM web interface under Dashboard -> (My organization) -> Reports.

I hope someone can point me in the right direction. Thanks!

1
In other words, you want to download the rendered report (complete with data and all) ?Alex
Yes, but using the API - not the user interface. :-)andersbs

1 Answers

0
votes

I am also interested in this. Did you ever figure it out?

Sorry about not leaving this as comment, but apparently I don't have permissions.


Actually, I may have stumbled on the solution.

I noticed that when you download the report definition it has a field called d:CustomReportXml. In my custom reports this field contains XML code. <d:CustomReportXml>&lt;CustomReport&gt;&lt;Language&gt;1033&lt;/Language&gt;&lt;Query&gt;&lt;fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"&gt;&lt;entity name="appointment"&gt;&lt;attribute name="createdby" alias="createdby" /&gt;&lt;attribute name="createdon" alias="createdon" /&gt;&lt;/entity&gt;&lt;/fetch&gt;&lt;/Query&gt;&lt;Groupings /&gt;&lt;Columns&gt;&lt;Column ID="createdby0" Field="createdby" Width="100" /&gt;&lt;Column ID="createdon0" Field="createdon" Width="100" AddRawValueColumn="true" /&gt;&lt;/Columns&gt;&lt;TableLayout Display="Normal" /&gt;&lt;/CustomReport&gt;</d:CustomReportXml>

inside the XML is a fetch tag <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="appointment"><attribute name="createdby" alias="createdby" /><attribute name="createdon" alias="createdon" /></entity></fetch>

I have been able to parse this out and pass it back to dynamics via the api and get back results. I am using http://www.xrmtoolbox.com/ to test the results and so far things look promising.

I can also add a filter to the fetchXML so I don't end up with too much data.

I hope it helps you.