D365 V9 Alert Dialog

Posted On April 25, 2018 by Admin Posted in 

Introduction:

This blog explains how to show alerts in D365 V9.

Details:

We often get requirement to show alerts in D365 V9 Forms and can be achieved using below syntax.

Xrm.Navigation.openAlertDialog(alertStrings,alertOptions).then(closeCallback,errorCallback);

Example:
1. Alert with no callbacks.

var alertStrings = { text: "successfully checkedin." };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then( function () { }  );

2. Alert with callback method.

var alertStrings = { confirmButtonLabel: "Yes", text: "This is an alert." };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
    function success(result) {
        console.log("Alert dialog closed");
    },
    function (error) {
        concole.log(error.message);
    }
);

Note: Xrm.Utility.alertDialog(message,onCloseCallback) is been deprecated.


Share Story :