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.");
});
Related articles
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기