We found something quite interesting this week whilst developing a new system for one of our customers in Dynamics CRM 2013, and thought it would be important to share this with you all.

How it started …

We started getting reports from our testers that they were getting a Microsoft error message whenever they refreshed the form when working on a Case (incident). The message would appear on any type of form refresh, so for instance running a dialog/workflow would cause it to happen.

The message was as below:

<CrmScriptErrorReport>

<ReportVersion>1.0</ReportVersion>

<ScriptErrorDetails>

<Message>Error initializing component with element id=’CaseResearch_LinkControl_resolvedcasesgrid’ and with type=’Mscrm.GridControlLite’: Object doesn’t support property or method ‘get_displayState'</Message>

<Line>0</Line>

<URL>/main.aspx?etc=112&extraqs=%3f_gridType%3d112%26etc%3d112%26id%3d%257b3C1C2772-CBFD-E311-905D-005056BB5D6D%257d%26rskey%3d248712960&pagemode=iframe&pagetype=entityrecord&rskey=248712960</URL>

<PageURL>/main.aspx?etc=112&extraqs=%3f_gridType%3d112%26etc%3d112%26id%3d%257b3C1C2772-CBFD-E311-905D-005056BB5D6D%257d%26rskey%3d248712960&pagemode=iframe&pagetype=entityrecord&rskey=248712960</PageURL>

<Function>anonymous(type,properties,events,references,element){try{if(!Mscrm.PageManager.$1q)return$create(type,properties,events,references,element)}catch($v_0){if(!element)returnnull;var$v_1=String.format(“Errorinitializingcomponentwithelementid='{0}’andwithtype=</Function>

<CallStack>

<Function>anonymous(type,properties,events,references,element){try{if(!Mscrm.PageManager.$1q)return$create(type,properties,events,references,element)}catch($v_0){if(!element)returnnull;var$v_1=String.format(“Errorinitializingcomponentwithelementid='{0}’andwithtype='{1}’:{2}”,!element?”null”:element.id,!type?”null”:type.getName(),$v_0.message);catchError($v_1,window.location.href,0,true)}returnnull}</Function>

<Function>CaseResearch_LinkControl_resolvedcasesgrid_Init()</Function>

<Function>anonymousanonymous(){functionCaseResearch_LinkControl_resolvedcasesgrid_Init(){if(IsNull($find(‘__Page_crmEventManager’)))window.setTimeout(‘CaseResearch_LinkControl_resolvedcasesgrid_Init()’,10);else{crmCreate(Mscrm.GridControlLite,{“subscribedEvents”:[42,4,50,95,38,9,87]},null,{“eventManager”:”__Page_crmEventManager”},$get(‘CaseResearch_LinkControl_resolvedcasesgrid’));}}CaseResearch_LinkControl_resolvedcasesgrid_Init();}</Function>

<Function>anonymous($p0,$p1,$p2,$p3,$p4){var$v_0=$get($p1);if(IsNull($v_0)){window.setTimeout(function(){Mscrm.GridControl.$4P($p0,$p1,$p2,$p3,$p4)},10);return}var$v_1=XUI.Xml.GetText(XUI.Xml.SelectSingleNode($p0,”//gridXml/gridHtml”,null));Mscrm.Utilities.assignInnerHtml($v_0,$v_1);var$v_2=$get($p2);!IsNull($p3)&&$p3!==””&&Mscrm.GridControl.setElementParameter($v_2,”oId”,$p3);var$v_3=XUI.Xml.GetText(XUI.Xml.SelectSingleNode($p0,”//gridXml/gridHeader”,null));$v_3+=XUI.Xml.GetText(XUI.Xml.SelectSingleNode($p0,”//gridXml/gridInitFunctionName”,null))+”();”;var$v_4=newFunction($v_3);$v_4.apply(window);Mscrm.GridControl.$7h($v_2)}</Function>

<Function>anonymous(){Mscrm.GridControl.$4P($v_0.responseXML,containerId,gridId,oId,isSubGridLite)}</Function>

</CallStack>

</ScriptErrorDetails>

<ClientInformation>

<BrowserUserAgent>Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; InfoPath.3)</BrowserUserAgent>

<BrowserLanguage>en-GB</BrowserLanguage>

<SystemLanguage>en-GB</SystemLanguage>

<UserLanguage>en-GB</UserLanguage>

<ScreenResolution>1344×840</ScreenResolution>

<ClientName>Web</ClientName>

<ClientTime>2014-07-09T09:12:17</ClientTime>

</ClientInformation>

<ServerInformation>

<OrgLanguage>1033</OrgLanguage>

<OrgCulture>2057</OrgCulture>

<UserLanguage>1033</UserLanguage>

<UserCulture>2057</UserCulture>

<OrgID>{23688D06-F59B-E011-A41B-00505699523F}</OrgID>

<UserID>{29DCBBF5-F6CA-E311-A91F-00505699523F}</UserID>

<CRMVersion>6.0.2.51</CRMVersion>

</ServerInformation>

</CrmScriptErrorReport>

The investigation …

Searching the online communities for “CaseResearch_LinkControl_resolvedcasesgrid” drew a blank.

Checking the custom code on the form also drew a blank.

Then one of the guys spotted a section on the Case Form called “Research”. It was a locked section (so it couldn’t be removed from the Form), yet it was marked as Visible. It didn’t, however, show up on the Form at run time.

We wondered if this was something that came out of the box with a new install, and yep, it sure is!

Next we created a brand new Form and ran it up – low and behold we didn’t have the issue …

The solution …

Intrigued by the “Research” section, we then inspected the Business Process Flows that were on the Case form.

We noticed something called “Similar Cases” in the Research section:

Business Process Flows Issues  1

This is a special Step that you can add to a Business Process Flow – a little awkward to find. Click on the little drop down arrow next to the Steps + :

Business Process Flows Issues  2

Low and behold this was the issue!

Conclusion …

If you use the Research stage in a Business Process Flow attached to the Case form, you MUST include the “Similar Cases” step. This applies to all Business Process Flows you use against Cases i.e. update them all to contain this step else the one you don’t update will still cause the error.

Hope this helps …