openAlertDialog (Client API reference)
Displays an alert dialog containing a message and a button.
Syntax
Xrm.Navigation.openAlertDialog(alertStrings,alertOptions).then(closeCallback,errorCallback);
Parameters
Name | Type | Required | Description |
---|---|---|---|
alertStrings | Object | Yes | The strings to be used in the alert dialog. The object contains the following values: - confirmButtonLabel: (Optional) String. The confirm button label. If you do not specify the button label, OK is used as the button label. - text: String. The message to be displayed in the alert dialog. - title: (Optional) String. The title of the alert dialog. |
alertOptions | Object | No | The height and width options for alert dialog. The object contains the following values: - height: (Optional) Number. Height of the alert dialog in pixels. - width: (Optional) Number. Width of the alert dialog pixels. |
successCallback | function | No | A function to execute when the alert dialog is closed by either clicking the confirm button or canceled by pressing ESC. |
errorCallback | function | No | A function to execute when the operation fails. |
Example
The following sample code displays an alert dialog. Clicking Yes button in the alert dialog or canceling the alert dialog by pressing ESC calls the close
function::
var alertStrings = { confirmButtonLabel: "Yes", text: "This is an alert.", title: "Sample title" };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function (success) {
console.log("Alert dialog closed");
},
function (error) {
console.log(error.message);
}
);
Related topics
Feedback
Submit and view feedback for