Viewing Executed SQL or FetchXml in Microsoft CRM Reports

Printer-friendly version

One important thing about any CRM system is being able to get data out of the system; in other words: reports. Reports aren't sexy for developers, but they're important for end users.

Sometimes as you're debugging a report, you want to see exactly what was executed by the reporting engine to retrieve the data because something isn't exactly what you expect. You're not sure what parameters are being sent, or maybe you just want to get the full query with real parameters.

I stumbled across something that makes it easy! If you want to see the SQL that was run to create the report, you can add a text box to the report and add the following expression to the text box:

=DataSets!DataSet1.CommandText

Where DataSet1 is the name of your Dataset.

A note about this: if your report has been written using FetchXml, the output will not be SQL but rather the FetchXml that was used to generate the report. Also, the excellent XrmToolBox tool has a plugin for testing FetchXml.

Comments (0)

Related Blogs

TheReact Native Open Source roadmap was announced in Q4 2018 after they decided to invest more in the React Native open source community.

October is not just about pumpkins, fall foliage, and cooler temps anymore. October 2018 also means the exciting introduction of Microsoft Dynamics 365 for Customer Engagement.

Back in 2016, Microsoft introduced its intentions to refresh its CRM and ERP strategy with Dynamics 365. At the heart of its services was the Common Data Model (CDM).