Microsoft Dynamics CRM Error Dialog – using Xrm.Internal.openErrorDialog

By this time many of you might have already explored the Xrm.Internal namespace and displayed your custom webresources in CRM 2013/ 2015 modal style. Well, if you have not, I suggest you check my blog post https://debajmecrm.com/exploring-the-xrm-internal-namespace-in-crm-2013/ to explore the Xrm.Internal namespace and i bet you would like it.

Coming back to the topic, if we open our custom webresources in CRM modal style, why not show the custom client side errors in CRM 2013 style? If you are thinking how to to do this, you have to come back to Xrm.Internal namespace and explore its Xrm.Internal.openErrorDialog method.

First let us explore the Xrm.Internal.openErrorDialog method. The following is the nomenclature of this method.

function (errorCode,message,serializedException){var $v_0="0x"+(errorCode<0?4294967295+errorCode+1:errorCode).toString(16).toUpperCase();if(IsNull(serializedException))openErrorDlg($v_0,message,null,0,0);else openErrorDlgWithDetailedInfo($v_0,message,serializedException,0,0)}

So we can see that it accepts three parameters

  • Error Code
  • Message
  • Serialized Exception

Error Code : If you see the nomenclature, it appends “0x” to the error code. It should be a number. If you enter anything other than integer, the method might not work as expected.

Message: I have tried multiple combinations but whatever i entered does not reflect. However if anybody reading this can explore this, it would be extremely beneficial.

Serialized Exception: This is the most important parameter. Whatever value you put here is the one that would come when the user clicks on “Download Log file” button.

As an example, in the account form load, I have called the method as shown in the screenshot below.

image

 

Now when the form loads, the following error message is displayed. When the user clicks on ‘Download Log File’ you can see the Downloaded error message.

image

Hope this helps!

4 thoughts on “Microsoft Dynamics CRM Error Dialog – using Xrm.Internal.openErrorDialog”

  1. Pingback: Dynamics of Dynamics CRM

  2. Pingback: CRM Backlog

  3. Pingback: CRM Backlog

Comments are closed.