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
        
        
            
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
}
);
}
    
    - 
                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
 
- 
                        details
                        
- 
                successCallback
                
 This function will be called when the alert dialog is closed
- 
                errorCallback
                
 This function will be called if the operation fails
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
}
);
}
 
    
        Hope This Helps!
    
 
 
Comments
Post a Comment