Dynamics 365 Education and Knowledge

Dynamics 365 Education and Knowledge

https://charlesabikhirs.blogspot.com

ERROR DIALOG IN DYNAMICS 365 JAVASCRIPT

Published

ERROR DIALOG IN DYNAMICS 365 JAVASCRIPT

In another posts, we saw how to display a Confirm Dialog in Dynamics 365 using JavaScript and how to display an Alert Dialog in Dynamics 365 using JavaScript

In this post, we will see how to display an Error Dialog in Dynamics 365 using JavaScript and what are the different properties that can be set.

The error dialog will be used to display an error message on the form
  1. errorOptions
    Contains the different dialog display properties:
    • details
      Contains details about the error. If specified, the user will be able to click the button Download Log File to download a text file that contains the message specified in this option
    • errorCode
      If you want to show specific error, you can put the code of the error that will be displayed in the error dialog. A default message will be displayed if the code is not valid
    • message
      Contains the value of the message that will be displayed in the error dialog
  2. successCallback
    This function will be called when the alert dialog is closed
  3. errorCallback
    This function will be called if the operation fails
The below code is a sample on how to use and display an Error Dialog

function displayErrorDialog(context) {
var errorOptions = {
errorCode: 1234,
details: "The details that will be in the content of the downloaded log file",
message: "This is the error dialog message!"
};
Xrm.Navigation.openErrorDialog(errorOptions).then(
function (success) {
// Do something here
},
function (error) {
// Do something here
}
);
}


Error Dialog

Hope This Helps!

Continue to website...

More from Dynamics 365 Education and Knowledge