Error Uploading Report in Dynamics CRM 2011

Well here is an interesting one for you…

I have been doing some report modifications for a client that is using Microsoft Dynamics CRM 2011 Online. When I attempted to upload my changes, I recieved the following error message:

Error Uploading Report

An Error Occurred while trying to add the report to Microsoft Dynamics CRM.

Try this Action Again. If the problem continues, check the Microsoft Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.

When I review the log file available for download, it says (and I highlighted the really important part…):

 

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, 
Version=5.0.0.0, 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 >
  <ErrorCode>-2147188072</ErrorCode>
  <ErrorDetails />
  <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>
  <Timestamp>2012-03-13T16:32:53.8315396Z</Timestamp>
  <InnerFault i_nil=”true” />
  <TraceText i_nil=”true” />
</OrganizationServiceFault>

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, 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 >  <ErrorCode>-2147188072</ErrorCode>  <ErrorDetails />  <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>  <Timestamp>2012-03-13T16:32:53.8315396Z</Timestamp>  <InnerFault i_nil=”true” />  <TraceText i_nil=”true” /></OrganizationServiceFault>

 

So this is really obvious (dripping with sarcasm).

Given the generic nature of both of these errors, I started making small changes to the report and publishing them in an effort to isolate the change that was causing the error. As it turns out, I was using a SWITCH function in the formula on one of my report expressions. Although the report would preview with the SWITCH function just fine, this was causing the above error. As soon as I removed the SWITCH function, my report would publish to Dynamics CRM 2011 without error.

So, I converted the SWITCH function to an IIF function and problem solved! 

Hope this helps!