As you probably know, Dynamics CRM 2011 comes
in two versions: Online and On Premise. Both use
the same codebase, but there some differences.
For CRM On Premise customers who decide to
move to Online, they find they can no longer directly
query the SQL Filtered Views to retrieve data for
custom reports. This is a platform restriction for
security purposes. Makes sense, but it can be an
issue for those (like me) used to writing reports with
SQL queries.
The FetchXML method of report development is now
the recommended way to write custom SSRS reports
for CRM Online and of course it also works for On
Premise as well. To get started there are two
prerequisite packages to install:
SQL Server 2008 R2 Business Intelligence
Development Studio (BIDS). Installing BIDS will also
install Visual Studio 2008 stripped-down version for
developing SSRS reports.
Microsoft Dynamics CRM 2011 Fetch Authoring
Extension for BIDS. This provides the to add
Microsoft Dynamics CRM Fetch data source in SSRS
reports. To configure this data source for your report
you need to provide CRM Server URL, Organization
Name and Windows Live Credentials or
Domain\Login.
Once the environment is prepared you can start
creating new reports. For this example I will start in
CRM by building my report query in Advanced Find,
then generating the FetchXML code that will be used
in the report definition file.
CRM 2011 makes it easy to generate FetchXML by
providing a button on the toolbar within Advanced
Find.
So you can use the familiar Advanced Find tool to
build your report query and generate the FetchXML
code. In the following example I will create a new
Case report based on a simple query for Cases that
were created in the last 7 days, where the
country =’United Kingdom’:
After verifying the query is returning what I want
by viewing the ‘Results’, I select ‘Download Fetch
XML’. The results are saved to a file, the contents
of which look like this in notepad:
Looking through the xml you can see the entity,
the attributes, the order and the filter conditions,
all of which are set through Advanced Find. The
next step will be to copy/paste this code into a new
report project in BIDS. The following steps illustrate
creating the report project:
1) Launch the BIDS tool and select
File | New | Project – then select
Report Server Project:
Provide a name for the report and ‘Save’. The
report will now appear as a project.
2) Highlight the report under ‘recent reports’
and right-click on ‘Reports’ in Solution
Explorer:
3) Select Add New Report and the New Report
Wizard will launch:
4) Clicking ‘next’ will take us to the DataSource
page (see below image). This is where we
setup the connection to the CRM Server:
- Choose ‘New data source’ (shared data
sources won’t work after uploading to
CRM server)
- Name the DataSource whatever you like
- Make sure the Type is ‘Microsoft
Dynamics CRM Fetch’
- Fill in the connection string in the
following format:
ServerURL;OrganizationName
5) Click Credentials and enter Windows Live ID
or Domain credentials depending on the
instance (Online or On Premise):
6) Click OK and Next. If the connection string
is validated you will be at a blank Query Builder
window. This is where we paste the FetchXML
we saved from CRM:
7) Click next and continue on through the
Report Wizard to format the report layout,
grouping and style.
8) The end result will be the ‘RDL’ file, which
is uploaded into CRM to generate the new report.
Back in CRM we are ready to upload the RDL file.
Navigate to Workplace | Reports and select ‘New’
on the ribbon toolbar:
From the new report screen:
From the CRM Service Report category you can now
see and run the new report.
This report query was quite simple and could have
been accomplished through the CRM Report Wizard.
The advantage of using the FetchXML method is
being able to design more complex queries with
data from multiple entities through Advanced Find.
The CRM Report Wizard has significant limitations in
regards to query building. So, if you are going to be
writing custom reports for CRM Online, you will likely
be doing so with FetchXML. Have fun!
- Doug Hunter






















