web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Weird Contact form JS exception on form close

(1) ShareShare
ReportReport
Posted on by 65

Hi Folks

I've spent all day on this one and out of options hoping this will be a standard gotcha type issue. I'm seeing a real weird error and struggling to even trace the root cause. The scenario here is that we have two users both have system admin privileges (dev online 2016 sandbox). There is a custom form, with "no" JS libraries associated with it on the form. Whenever I access a contact record then navigate away it always gives me an error for *all* other users except one (namely myself). Then to make it more confusing in the UAT environment (Same tenant) the error happens for all users (myself included). Different behavior but the same solution and security role in both. The form has been set to be available to everyone under the form enable security role settings. All other contact forms work without issue! As I said earlier there is no form library on the custom form. The only thing I did modify in dev was a subgrid's + behavior via Ribbon Bench to show a search instead of a quick create form.

65434.Untitled.png

The error details:

<CrmScriptErrorReport>
  <ReportVersion>1.0</ReportVersion>
  <ScriptErrorDetails>
   <Message>Unable to get property 'className' of undefined or null reference</Message>
   <Line>0</Line>
   <URL>/form/page.aspx?lcid=1033&themeId=8dbb98e6-a1a8-40ed-c83f-688767fb9a85&tstamp=627957&updateTimeStamp=635906496502128753&userts=131000265151606335&ver=-114056169#etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b6DA6E5B9-88DF-E311-B8E5-6C3BE5A8B200%257d%26rskey%3d%257b00000000-0000-0000-00AA-000010001004%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010001004%7d&counter=1455553167284</URL>
   <PageURL>/form/page.aspx?lcid=1033&themeId=8dbb98e6-a1a8-40ed-c83f-688767fb9a85&tstamp=627957&updateTimeStamp=635906496502128753&userts=131000265151606335&ver=-114056169#etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b6DA6E5B9-88DF-E311-B8E5-6C3BE5A8B200%257d%26rskey%3d%257b00000000-0000-0000-00AA-000010001004%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010001004%7d&counter=1455553167284</PageURL>
   <Function>anonymous(){var$v_0=this.$9H_1.toDictionary();var$$dict_3=$v_0;for(var$$key_4in$$dict_3){var$v_2={key:$$key_4,value:$$dict_3[$$key_4]};var$v_3=$v_2.value;if(!$v_3.$5p_2){$v_3.initialize();}}var$v_1=this.get_viewMap().toDictionary();var$$dict_9=$v_1;for(va</Function>
   <FunctionRaw>function() {
        var $v_0 = this.$9H_1.toDictionary();
        var $$dict_3 = $v_0;
        for (var $$key_4 in $$dict_3) {
            var $v_2 = { key: $$key_4, value: $$dict_3[$$key_4] };
            var $v_3 = $v_2.value;
            if (!$v</FunctionRaw>
   <CallStack>
    <Function>anonymous(){var$v_0=this.$9H_1.toDictionary();var$$dict_3=$v_0;for(var$$key_4in$$dict_3){var$v_2={key:$$key_4,value:$$dict_3[$$key_4]};var$v_3=$v_2.value;if(!$v_3.$5p_2){$v_3.initialize();}}var$v_1=this.get_viewMap().toDictionary();var$$dict_9=$v_1;for(var$$key_Ain$$dict_9){var$v_4={key:$$key_A,value:$$dict_9[$$key_A]};var$v_5=$v_4.value;try{$v_5.bind();}catch($v_6){Mscrm.CrmDebug.fail(String.format('Exceptionencounteredbinding{0}:{1}',$v_5.getKey(),$v_6.message));catchError($v_6.message,window.location.href,0,true);}}}</Function>
    <Function>anonymous(){this.$9d_1=true;this.ui.bindUI();if(this.$4L_1.toArray().length>0){Mscrm.TurboForm.Control.PageManager.get_instance().startUIUpdate();}}</Function>
    <Function>anonymous(){this.$M_1.bindUI();}</Function>
    <Function>anonymous($p0,$p1,$p2){var$v_0=$p0._error;if(!IsNull($v_0)){var$v_1=Mscrm.ErrorInformation.createErrorInfo($v_0.Code,$v_0.DisplayText,$v_0.SerializedException);var$v_2=Mscrm.Utilities.createCallbackFunctionObject('errorDialogCallback',Mscrm.TurboForm.Control.PageBootstrapper,null,false);openErrorDlg($v_0.Code,$v_0.DisplayText,$v_1,0,0,$v_2);return;}else{for(var$$arr_6=$p0.Descriptor.FormDescriptor,$$len_7=$$arr_6.length,$$idx_8=0;$$idx_8<$$len_7;++$$idx_8){var$v_C=$$arr_6[$$idx_8];Mscrm.TurboForm.Control.PageBootstrapper.$D0($v_C);}var$v_3='TODO:Handlelayouttemplatenotfound.';var$v_4=Mscrm.TurboForm.Control.PageBootstrapper.$40();$v_4.descriptors=$p0.Descriptor.FormDescriptor;$v_4.ProcessControlRule=$p0.processControlRule;$v_4.primaryFormId=newMicrosoft.Crm.Client.Core.Framework.Guid($p0.Descriptor.PrimaryFormId);$v_4.entityMetadata=Mscrm.TurboForm.Control.PageBootstrapper.$HZ($p0.entityMetadata);$v_4.InlineEditSubGrids=Mscrm.TurboForm.Control.PageBootstrapper.$Ha($p0.InlineEditSubGrids);var$v_5=$p0.header;$v_4.applicationInitDeferredStatements=$p0.header.ApplicationInitDeferredStatements;$v_4.sfaTabsInitDeferredStatements=$p0.header.SFATabsInitDeferredStatements;$v_4.caseSFATabsInitDeferredStatements=$p0.header.CaseSFATabsInitDeferredStatements;var$v_6=Xrm.Internal.startMetricsStopwatch('InjectLayoutIncludestoPage');$v_6.start();Sys.Application.beginCreateComponents();eval($v_5.TurboApplicationInitStatements);Sys.Application.endCreateComponents();Mscrm.TurboForm.Control.PageBootstrapper.$Cq($v_5.StyleIncludes);Mscrm.TurboForm.Control.PageBootstrapper.$Cm($v_5.TurboScriptIncludes);Mscrm.TurboForm.Control.DisposalManager.clearExistingDataClientVariables();Mscrm.TurboForm.Control.DisposalManager.clearExistingLayoutClientVariables();Mscrm.TurboForm.Control.PageBootstrapper.$GF($v_5.ClientVariables);$v_6.stop();var$v_7=Xrm.Internal.startMetricsStopwatch('RenderFormLayout');$v_7.start();var$v_8=$v_5.JQueryTemplates;$v_4.templates=$v_8;for(var$v_D=0;$v_D<$v_8.length;$v_D++){var$v_E=$v_8[$v_D];if($v_E.Key==='rootJQueryTemplate'){$v_3=$v_E.Value;break;}}Mscrm.TurboForm.Control.PageBootstrapper.$Hq($v_3);$v_7.stop();var$v_9=Xrm.Internal.startMetricsStopwatch('InitializeApplicationComponents');$v_9.start();Sys.Application.beginCreateComponents();eval(createFormControlLite);eval(createPageManager);eval(createEventManager);eval(SubGridCommandBarData);Sys.Application.endCreateComponents();$v_9.stop();if($v_4.formType!==7&&!$v_4.recordId.equals(Microsoft.Crm.Client.Core.Framework.Guid.get_empty())){var$v_F=Xrm.Internal.startMetricsStopwatch('RequestSubgridsData');$v_F.start();Mscrm.TurboForm.Control.PageBootstrapper.$Ht();$v_F.stop();}var$v_A=Xrm.Internal.startMetricsStopwatch('InitializeXrmControlsandData');$v_A.start();Mscrm.TurboForm.Control.PageManager.get_instance().initialize();$v_A.stop();var$v_B=Xrm.Internal.startMetricsStopwatch('BindXrmtoHTML');$v_B.start();Mscrm.TurboForm.Control.PageManager.get_instance().bindUI();$v_B.stop();Mscrm.TurboForm.Control.PageManager.get_instance().initializeProcessControl($v_4);$v_4.layoutReady=true;Xrm.XrmPerformance.measureTime('OnLayoutReadyhandlers',function(){returnMscrm.TurboForm.Control.PageBootstrapper.$6t('OnLayoutReady');});Mscrm.Performance.PerformanceMarkerManager.get_instance().addMarker('PageReadyforDataBind',1);Mscrm.TurboForm.Control.PageBootstrapper.$E8($p1,$p2);}}</Function>
    <Function>anonymous($p1_0){$v_0.stop();var$v_1=Xrm.Internal.startMetricsStopwatch('ParseFormLayoutResponseJson');$v_1.start();var$v_2=Mscrm.TurboForm.Control.PageBootstrapper.$BE($p1_0);$v_1.stop();if($v_2){var$v_3=Mscrm.TurboForm.Control.PageBootstrapper.$F3($p1);var$v_4=Mscrm.TurboForm.Control.PageBootstrapper.$F2($p1);var$v_5=Xrm.Internal.startMetricsStopwatch('ProcessFormLayout');$v_5.start();Mscrm.TurboForm.Control.PageBootstrapper.$Hc($v_2,$v_3,$v_4);$v_5.stop();}}</Function>
    <Function>anonymous(){if($v_0.readyState!==4){return;}$v_0.onreadystatechange=null;if($v_0.status!==200){}successCallback($v_0.responseText);$v_0=null;}</Function>
   </CallStack>
  </ScriptErrorDetails>
  <ClientInformation>
   <BrowserUserAgent>Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Tablet PC 2.0; MS-RTC LM 8; InfoPath.3; rv:11.0) like Gecko</BrowserUserAgent>
   <BrowserLanguage>en-US</BrowserLanguage>
   <SystemLanguage>en-GB</SystemLanguage>
   <UserLanguage>en-US</UserLanguage>
   <ScreenResolution>1422x800</ScreenResolution>
   <ClientName>Web</ClientName>
   <ClienState>Online</ClienState>
   <ClientTime>2016-02-15T16:19:27</ClientTime>
  </ClientInformation>
  <ServerInformation>
    <OrgLanguage>1033</OrgLanguage>
    <OrgCulture>1033</OrgCulture>
    <UserLanguage>1033</UserLanguage>
    <UserCulture>1033</UserCulture>
    <OrgID>{7C8E99C3-AEFC-4D78-B269-7435647DD1C6}</OrgID>
    <UserID>{33AF6AE5-43C4-E511-80D9-5065F38A29E1}</UserID>
    <CRMVersion>8.0.0.2091</CRMVersion>
  </ServerInformation>
</CrmScriptErrorReport>

<CrmScriptErrorReport>
  <ReportVersion>1.0</ReportVersion>
  <ScriptErrorDetails>
   <Message>Unable to get property 'firstChild' of undefined or null reference</Message>
   <Line>0</Line>
   <URL>/form/page.aspx?lcid=1033&themeId=8dbb98e6-a1a8-40ed-c83f-688767fb9a85&tstamp=627957&updateTimeStamp=635906496502128753&userts=131000265151606335&ver=-114056169#etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b6DA6E5B9-88DF-E311-B8E5-6C3BE5A8B200%257d%26rskey%3d%257b00000000-0000-0000-00AA-000010001004%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010001004%7d&counter=1455553167284</URL>
   <PageURL>/form/page.aspx?lcid=1033&themeId=8dbb98e6-a1a8-40ed-c83f-688767fb9a85&tstamp=627957&updateTimeStamp=635906496502128753&userts=131000265151606335&ver=-114056169#etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b6DA6E5B9-88DF-E311-B8E5-6C3BE5A8B200%257d%26rskey%3d%257b00000000-0000-0000-00AA-000010001004%257d&pagemode=iframe&pagetype=entityrecord&rskey=%7b00000000-0000-0000-00AA-000010001004%7d&counter=1455553167284</PageURL>
   <Function>anonymous(){var$v_0=this.$9H_1.toDictionary();var$$dict_3=$v_0;for(var$$key_4in$$dict_3){var$v_2={key:$$key_4,value:$$dict_3[$$key_4]};var$v_3=$v_2.value;if(!$v_3.$5p_2){$v_3.initialize();}}var$v_1=this.get_viewMap().toDictionary();var$$dict_9=$v_1;for(va</Function>

Before I go down the path of creating a new custom form from scratch to see if this resolves was hoping you could provide me with some pointers on where to start looking. Could it be down to some hardcoded GUID in the core JS SDK/JS web resources? I inherited the code from a previous contractor and just trying to figure out what are the possible causes for this behavior and where to take the investigation?

Thanks in Advance

*This post is locked for comments

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I would suggest to turn off all custom event handlers you have on form an turn it on one-by-one to find "bad" handler and then you can analyze it to find what can cause an error.

  • Antony Ellis Profile Picture
    65 on at

    Hi Andrii

    Thanks for the suggestion. As I mentioned there are no custom event handlers on the form. In fact there is "no JS library" on the form. Hence why I am really struggling to trace the root cause and explain the behavior. Even the sub-grid that I modified (via ribbon bench) has been removed off the form and it still didn't resolve. Perhaps there is somewhere else I need to check? I'd imagine that they might be core JS files for a contact entity that is used by the system which I could check maybe?

    Thanks

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Then I would suggest to get in touch with Microsoft and open support ticket.

  • Suggested answer
    Antony Ellis Profile Picture
    65 on at

    Hi think I have found this to be a bug in Dynamics Online 2016? You can re-create the error yourself. Create a new main form for the Contact entity. Add the attribute FullName to the Header save->publish. The next time you go into a contact record on that form then navigate away you will get the JS error. I have confirmed this *on a completely separate tenant* and the behavior was consistent. Any ideas? Both were on the following version:44462.Untitled.png

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    As I already mentioned this looks like a bug and you can get in touch with Microsoft Support to find solution for it.

  • Tobias Koller Profile Picture
    on at

    just to let you know: i could also reproduce this error ;)

  • Antony Ellis Profile Picture
    65 on at

    Great thanks for testing and confirming this will no doubt help others who may stumble across it. I spent 1.5 days debugging JS, plugins and Security roles before tracing it to that one field in that specific place! Not fun.

  • Suggested answer
    Antony Ellis Profile Picture
    65 on at

    Update for everyone. I've spoken with Microsoft who confirmed that the coding error does exist along with the root cause and a possible workaround. In a nutshell when trying to place a "composite" attribute such as FullName or Address (for example) in either the header or the footer of a form you will get the JavaScript exception on form close. Apparently the new Turbo forms introduced in 2015 Update 1 is known to be buggy and being worked on with hopefully a fix in a future release. The obvious way therefore to fix this is to have no composite type fields in the header or footer. If that won't work for you then go into Settings->Administration->System Settings and at the bottom of the form change the legacy form rendering from No to Yes:

    13168.Untitled.png

    This will then allow you to place composite fields in the header/footer. Interestingly the person I spoke with suggested turning this on as standard until bugs ironed out with the turbo forms. The performance impact relates to form loading having a delay before JS finishes executing which for most people shouldn't be too noticeable or cause an issue.

  • Community Member Profile Picture
    on at

    Hi

    I am getting the same issue, now. Is the problem still exists?? . As this thread is 1 yr old  we got any update patch from Microsoft.

    Thhanks

    MSBK

  • Guowei_Xu Profile Picture
    407 on at

    Hi ,

    Thanks for your share, i have resolved my issue just like yours.

    Is there any update patches from Microsoft have resolved this issue?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans