Hi,

Trying to add a confirm prompt when user click on Send email button to perform some checking, so in my script i do cancel the save operation & execute my validation logic.

At the same time i will get below error message & not sure how to get rid of it. but the same logic if i put to Save or Save & close its working fine.

My script

emailOnSave = function(executionContext) {
    var eventArgs = executionContext.getEventArgs();

    if (eventArgs.getSaveMode() == 7) {
        eventArgs.preventDefault();
        var confirmStrings = {
            text: "xxx?",
            title: "CONFIRM"
        };
        var confirmOptions = {
            height: 200,
            width: 450
        };
        Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
            function(success) {
                if (success.confirmed) {
                    // custom logic
                }
            });
    }
}

Anyone?