openErrorDialog (Client API reference)

Displays an error dialog.

Syntax

Xrm.Navigation.openErrorDialog(errorOptions).then(successCallback,errorCallback);

Parameters

Name Type Required Description
errorOptions Object Yes An object to specify the options for error dialog. The object contains the following values:
- details: (Optional) String. Details about the error. When you specify this, the Download Log File button is available in the error message, and clicking it will let users download a text file with the content specified in this value.
- errorCode: (Optional) Number. The error code. If you just set errorCode, the message for the error code is automatically retrieved from the server and displayed in the error dialog. If you specify an invalid errorCode value, an error dialog with a default error message is displayed.
- message: (Optional) String. The message to be displayed in the error dialog.

You must set either the errorCode or message value.
successCallback function No A function to execute when the error dialog is closed.
errorCallback function No A function to execute when the operation fails.

Example

The following code sample passes an incorrect errorCode (1234) to display an error dialog with default message:

Xrm.Navigation.openErrorDialog({ errorCode:1234 }).then(
    function (success) {
        console.log(success);        
    },
    function (error) {
        console.log(error);
    });

This displays an error dialog with the default message:

Error dialog with default message.

Xrm.Navigation
List of error codes