Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Displays an alert dialog containing a message and a button.
Syntax
Xrm.Navigation.openAlertDialog(alertStrings,alertOptions).then(successCallback,errorCallback);
Parameters
Note
When you enable the new look, the dialog height resizes automatically if you don't set the height value of the dialog options.
| Name | Type | Required | Description |
|---|---|---|---|
alertStrings |
Object | Yes | The strings to use in the alert dialog. The object contains the following values: - confirmButtonLabel: (Optional) String. The confirm button label. If you don't specify the button label, OK is used as the button label.- text: String. The message to display 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.When you enable the new look, the dialog height resizes automatically if you don't set the height value of the dialog options. |
successCallback |
function | No | A function to execute when the alert dialog closes either by clicking the confirm button or by pressing ESC. |
errorCallback |
function | No | A function to execute when the operation fails. |
Example
The following sample code displays an alert dialog. Selecting Yes 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);
}
);