Redaguoti

Bendrinti naudojant


openConfirmDialog (Client API reference)

Displays a confirmation dialog box containing a message and two buttons.

Syntax

Xrm.Navigation.openConfirmDialog(confirmStrings,confirmOptions).then(successCallback,errorCallback);

Parameters

Note

With the new look enabled, dialog height will resize automatically if you don't set the height value of the dialog options.

Name Type Required Description
confirmStrings Object Yes The strings to be used in the confirmation dialog. The object contains the following values:
- cancelButtonLabel: (Optional) String. The cancel button label. If you don't specify the cancel button label, Cancel is used as the button label.
- confirmButtonLabel: (Optional) String. The confirm button label. If you don't specify the confirm button label, OK is used as the button label.
- subtitle: (Optional) String. The subtitle to be displayed in the confirmation dialog.
- text: String. The message to be displayed in the confirmation dialog.
- title: (Optional) String. The title to be displayed in the confirmation dialog.
confirmOptions Object No The height and width options for confirmation dialog. The object contains the following values:
- height: (Optional) Number. Height of the confirmation dialog in pixels.
- width: (Optional) Number. Width of the confirmation dialog in pixels.

With the new look enabled, 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 confirmation dialog is closed by clicking the confirm, cancel, or X in the top-right corner of the dialog. An object with the confirmed (Boolean) attribute is passed that indicates whether the confirm button was clicked to close the dialog.
errorCallback function No A function to execute when the operation fails.

Example

The following code sample displays a confirmation dialog box. Appropriate message is logged in the console depending on whether confirm or cancel/X was clicked to close the dialog.

var confirmStrings = { text:"This is a confirmation.", title:"Confirmation Dialog" };
var confirmOptions = { height: 200, width: 450 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {    
    if (success.confirmed)
        console.log("Dialog closed using OK button.");
    else
        console.log("Dialog closed using Cancel button or X.");
});

Xrm.Navigation