One of the great features of Microsoft Dynamics CRM is the ability to create complex reports using SQL Server Data Tools (SSDT), formerly Business Intelligence Development Studio (BIDS). This puts the power of Visual Studio in your hands when working outside of CRM’s “Report Wizard” functionality.
However, if you’re not careful you might hit a frustrating snag when trying to upload your fresh, new RDL (Report Definition File) into CRM. If you receive a generic error that says “Error Uploading Report: An error occurred while trying to add the report to Microsoft Dynamics CRM” you’re not alone! Many have been plagued by this difficult and unhelpful message.
“What’s the problem exactly?” you might inquire. As many before you, you may be enticed to click “Download Log File” and take a look at ErrorDetails.txt. Then you see something like this:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator.</Message>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
Again, no help there. Even the so-called details are generic.
A quick search of Google will turn up many, many pages of people with similar issues. With such a generic message, there a just as many suggestions on how to fix it. Most of the time, however, the problem is far more devious than a couple mis-configured settings…
One of the limitations of developing custom reports for CRM is that it isn’t quite fully compatible with everything you can do in a non-CRM SSRS report. This means that your report may preview correctly and run correctly in Visual Studio, but will fail to work inside CRM! The worst part is there’s not a guide to explain what’s completely supported and what’s not. So it can be a game of trial and error when finding your offending code or formula.
Here’s an example… It’s common to want to use a simple formula to display a piece of data conditionally. Perhaps you want to display a more friendly name in the report:
That type of statement works perfectly within Visual Studio… But the report will fail to upload to CRM. Instead, you have to use the IIF function! In the case, that just means adding another “I” to the formula, as the format is identical:
There are many other examples of formulas that work in VS but not in CRM. Additionally, CRM Online has more restrictions than on-premises implementations. It may further differ if your on-premises environment is set up with RDL Sandboxing enabled. Regardless of deployment style and configurations, some functions simply don’t work in CRM and your report will fail to upload.
For safe code and formulas you can use, see the following resources. These are not exhaustive lists, but if you stick to the approved RDL Sandboxing functions you should be OK in all cases. If necessary, venture away from them gingerly, testing functions one at a time to ensure you maintain CRM compatibility.
- Create Reports for Microsoft Dynamics CRM Using SQL Server Reporting Services
- Custom code that is allowed for use in Microsoft Dynamics CRM Online FetchXML Reports
- RDL Sandboxing for Microsoft Dynamics CRM Online
Best of luck!