I am using below code, the problem is i am able to unsave the record for one condition and for other saving the record is not taking place. Need help with this
if(!saveFromConfirmDialog)
{
context.getEventArgs().preventDefault();
var confirmStrings = { text: "Address is already used by another project.", title: "Duplicate Address Found", confirmButtonLabel:"Save & Continue" , cancelButtonLabel: "Open Project"};
var confirmOptions = { height: 150, width: 450 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed) {
saveFromConfirmDialog = true;
formContext.data.entity.save();
}
else{
saveFromConfirmDialog = false;
window.open(url);
}
});
}
saveFromConfirmDialog = false;