Closing Modal CRM 2013 Dialog caused Javascript error

This question has suggested answer(s)

We recently moved a client to CRM 2013 and upon doing so we are seeing that a modal dialog now causes an error.

The code used to launch the modal dialog is..

var serverUri = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');

serverUri = serverUri + '?DialogId=' + dialogID + '&EntityName=' + typeName + '&ObjectId=' + recordId;

openStdDlg(serverUri ,"newWindow",615,480,true, false, "status=1,scrollbars=0,toolbar=0,menubar=0,location=0");  

What we are seeing is that if a user either cancels or finishes the dialog a javascript error is always thrown. The dialog performs as it should do and code after the dialog is executed correctly but we always get the error. Error is below.

Now I am not sure if the code is now supported or unsupported, however it is causing a bit of head scratching!!

Any help would be appreciated.

Thanks

Mark

All Replies
  • Hi Mark.

    I'm having the same error with the same javascript code. Exactly in the same line 1627.

    I also thought about the unsupported code, but then I tried to run the Dialog with the Run Dialog ribbon, and I'm getting the same error.

    If you find the solution please post it. I think that is CRM bug.

  • Not sure if this helps, but when we moved to CRM 2013, we were getting issues, which we originally thought were Java Script, but on removing it all the error was still there. After countless hours, we found an issue. It seems the UI in CRM 2013 now requires certain fields within a form. For example "all day event" in appointments. I heard similar issues with Leads and Quotes. Might be worth investigating.

  • Just to confirm that this is on CRM dialogs not forms

  • Mark you tried to run the dialog with the ribbon instead javascript? I also received the error. It seems to be a CRM bug

  • From the SDK you should call window.open.

    function openDialogProcess(dialogId, entityName, objectId)

    {

    var url = Xrm.Page.context.getClientUrl() +

     "/cs/dialog/rundialog.aspx?DialogId=" +

     dialogId + "&EntityName=" +

     entityName + "&ObjectId=" +

     objectId;

    window.open(url);

    }

    It's not modal (you can go to other tabs or windows) but its working.

    Shai

  • I have reviewed this option before and whilst this works it is not modal. The certain requirement needs the user to complete the dialog then redirect when finished.

  • Potentially point of interest... I have been experiencing the same errors when running modal dialogs following a CRM 2013 upgrade.  

    I have just updated my Chrome browser to the latest version (Version 31.0.1650.63 m) and the error above is now no longer occurring.  It still persists in IE.  Just thought it worth a mention. Thanks.

  • Try this, work perfectly in CRM 2013 in modal window

    var primaryEntityId = Xrm.Page.data.entity.getId();

       var rundialog = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');

       rundialog.get_query()['DialogId'] = '00000000-0000-0000-0000-000000000000'; //PUT YOUR GUID HERE

       rundialog.get_query()['ObjectId'] = primaryEntityId;

       rundialog.get_query()['EntityName'] = 'XXXXX'; //PUT YOUR ENTITY NAME

       openStdDlg(rundialog,buildWinName(null),615,480,null);

    if you don't want a modal Window, change openStdDlg by openStdWin

  • Try Jose's suggestion. It does not solve the problem. The Javascript error still comes up at the end of the dialog. Any other suggestion.

    This problem happens to some versions of IE Browsers. My IE version is: 9.0.8112.1621, Update Version: 9.0.22 (KB2888505). For some versions of IE (major version is 9), I just cannot open the dialog at all.