A JavaScript error occurs in the Microsoft Dynamics CRM 2011 List Component: "Sys.InvalidOperationException: A control is already associated with the element.”

Gjelder: Microsoft Dynamics CRM 2011SharePoint Server 2010SharePoint Server 2013

Introduction


On a Microsoft Dynamics CRM 2011 deployment integrated with Office SharePoint 2010 or Office SharePoint 2013, a user could get a JavaScript error the second time the user wants to open an Office document file from the same CRM grid.

While the first time the file opens as expected, the second time, the user needs to go back to the CRM web page. The CRM grid will start to refresh, raising the following JavaScript Exception: "Sys.InvalidOperationException: A control is already associated with the element”.


This behavior occurs if SharePoint has debug mode enabled.

To avoid this issue, SharePoint needs debug mode disabled.



Resolution


As a resolution, SharePoint debug mode need to be disabled:

1. Login to SharePoint server with administrative Privileges

2. Search for the file web.config under the application folder (e.g. "C:\inetpub\wwwroot\wss\VirtualDirectories\80")

3. Make a copy of the file

4. Open it with notepad

5. Search for: debug="true"

6. Update the debug value to be false: debug="false"

7. Save the file


Note that as soon as you make the change, it will then be automatically loaded by the IIS Server hosting the SharePoint application.