BIDS editing CRM reports – Cannot connect to CRM 2016 Online

I downloaded a report from CRM 2016 Online to make some modifications in Visual Studio. On preview, I received the following error message:

An error occurred during local report processing.
An error has occurred during report processing.
Cannot create a connection to data source '[DATASOURCE]'.
The connection to server "https://[orgname].crm.dynamics.com/XRMServices/2011/Discovery.svc" could not be established.
Make sure that the connection string and credentials are correct, and try again.
Metadata contains a reference that cannot be resolved:
'https://[orgname].crm.dynamics.com/_common/error/errorhandler.aspx?BackURI=&ErrorCode=&Parm0=[Arabic text]: The service '/XRMServices/2011/Discovery.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'Microsoft.Crm.Site.Services, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..&RequestUri=/XRMServices/2011/Discovery.svc?wsdl&user_lcid=1025'.
CData elements not valid at top level of an XML document. Line 1, position 3.

I found the Arabic symbols in the metadata error particularly surprising! Naturally, the first thing I tried to do was Google the error message. (I cannot copy-paste the text from the preview window, so I retyped it here.) Unfortunately, none of the hodge-podge of barely related error details returned anything helpful.

The resolution was simple, if obscure: the connection string in the downloaded .rdl file was the same as the URL of the web client, e.g.

https://orgname.crm.dynamics.com

I retrieved the Organization Unique Name from CRM, under Settings > Customizations > Developer Resources. (older versions look like org901234ab, while newer ones appear to be based on the actual name such as ‘trellispoint’). Change the connection string to:

https://disco.crm.dynamics.com;[ORG UNIQUE NAME]

That’s it! The report should be previewable through Visual Studio.
EDIT: Even easier, use the API subdomain like so:

https://orgname.api.crm.dynamics.com

CRM Online can’t run custom reports (rsProcessingAborted)

Ever try to run a custom report in CRM Online and see the following error(s): Reporting Error The report cannot be displayed (rsProcessingAborted); or Invalid Argument:

reportingerror1

reportingerror2

In order to run FetchXML-based reports in CRM Online, the system user running the report must have the following security role permissions: Customization > Entity read, Customization > Field read. We’ve determined this by adding only those two permissions to a security role, and like magic, our custom reports started working!

There may be other considerations such as access to the entities in the reports, but if everything else appears to be configured correctly and/or working for administrators but not users, check those role permissions.

MSCRM Online can’t access entity at all

Yesterday, I noticed an entity seemed to be completely broken throughout my CRM online instance. I could not get to the list view or detail form for any Case. I was also unable to open any of the forms from the customizations view. I just kept getting the generic error: “An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator. Finally you can contact Microsoft Support.”

I could not add new Cases through subgrids or quick-add either, and received the same error message, but this time with an option to download the error log. The log contains:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #AFE77CFEDetail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
 <ErrorCode>-2147220970</ErrorCode>
 <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
 <Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #AFE77CFE</Message>
 <Timestamp>2016-02-25T15:53:27.3663809Z</Timestamp>
 <InnerFault>
 <ErrorCode>-2147220970</ErrorCode>
 <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
 <Message>System.ArgumentNullException: Value cannot be null.
Parameter name: g</Message>
 <Timestamp>2016-02-25T15:53:27.3663809Z</Timestamp>
 <InnerFault i:nil="true" />
 <TraceText i:nil="true" />
 </InnerFault>
 <TraceText i:nil="true" />
</OrganizationServiceFault>

Finally found the solution here. It entails some editing of the XML for the entity in question.

  1. Create and export a solution containing the entity exhibiting the issue. Do not include dependencies.
  2. Extract the customizations.xml file from the resulting .zip file and open it for editing in the text editor of your choice.
  3. Search the text for the following text: “control id=”placeHolder_”. These are the invalid tags that are breaking everything!
  4. Carefully delete the containing <cell> tag for each occurrence. When complete, save the XML, replace the file in the solution .zip and re-import the edited solution.

This solved my issue and saved me the trouble of having to open a trouble ticket with Microsoft.

How to prevent textbox expanding horizontally in SSRS report

SSRS (a.k.a. SQL Server Tools) doesn’t show you the Intellisense for it, but regex is available in CRM online reports for string manipulation. (Here’s a full list of VB report functions available in CRM online.) The following expression will insert zero-length spaces (ChrW(8203)) between all characters in a string, so that a long string will always break if it runs out of space in a textbox, preventing your carefully-constructed tablix from getting wonky while still allowing the box to expand vertically.

I tried this with various versions of Split, Join, and ToString().ToCharArray() but was not getting the results I wanted. Array.ConvertAll is not available in the CRM Sandbox.

=System.Text.RegularExpressions.Regex.Replace(Iif(IsNothing(Fields!YourField.Value),"",Fields!YourField.Value), "(.)", "$1" & ChrW(8203).ToString())

XRMServices authentication error in CRM 2013/2015

Just posting this because I couldn’t find any info on the fix. When trying to access the XRMServices endpoint (in this case, to run XRMToolBox) I kept getting a bunch of errors. In the Event logs I see the following message:

The service '/XRMServices/2011/discovery.svc' cannot be activated due to an exception during compilation. The exception message is: The authentication schemes configured on the host ('Anonymous') do not allow those configured on the binding 'BasicHttpBinding' ('Negotiate'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

It looks like the fix for this is a setting in the global applicationHost.config which is located in C:\Windows\System32\inetsrv\config. For some reason windowsAuthentication was disabled for that path despite having the additional configuration options. Change enabled=”false” for the windowsAuthentication node. In my config the location path=”Microsoft Dynamics CRM/XRMServices/2011/Organization.svc” also had windowsAuthentication set to “false” so I changed that one too.

To edit this file, run Notepad as administrator. Make a backup before you change anything! 

    
<location path="Microsoft Dynamics CRM/XRMServices/2011">
        <system.webServer>
            <security>
                <authentication>
                    <digestAuthentication enabled="false" />
                    <basicAuthentication enabled="false" />
                    <anonymousAuthentication enabled="true" />
                    <windowsAuthentication enabled="true">
                        <providers>
                            <clear />
                            <add value="Negotiate" />
                            <add value="NTLM" />
                        </providers>
                    </windowsAuthentication>
                </authentication>
            </security>
        </system.webServer>
    </location>

Dynamics CRM Error Registering Plugins: “No Publisher Is Found, Assembly Must Be Registered In Isolation”

I created a Visual Studio solution consisting of a CRM Package and a Plugin. Later, I wanted to add a custom workflow project to this solution using Add > New Project > Dynamics CRM Workflow Library. When trying to deploy the new package, I got this error:

“No publisher is found, assembly must be registered in isolation.”

(This means that if the user is not a Deployment Administrator, they can’t register plugins unless they are in Sandbox mode. In CRM Online, there is no such thing!)

When Visual Studio adds a new CRM project from scratch, the following XML is appended to RegisterFile.crmregister:

<Solution Assembly="Custom.CRM.Workflows.dll" Id="00000000-0000-0000-0000-000000000000" IsolationMode="None" SourceType="Database">
  <WorkflowTypes>
    <WorkflowType FriendlyName="Custom Workflow" Name="CustomWorkflow" Description="My Custom Workflow" WorkflowActivityGroupName="Custom" Id="00000000-0000-0000-0000-000000000000" TypeName="Custom.CRM.Workflows.CustomWorkflow" />
  </WorkflowTypes>
</Solution>

This must be manually edited. The “IsolationMode” attribute must be changed from “None” to “Sandbox” in order to deploy the plugin to CRM Online. Also, all attributes for the WorkflowType are required: FriendlyName, Name, Description. The empty GUIDs are assigned by CRM after registration is successful.