Hi All,
I have below code on the OnSave() event of form. i have added below code
Ad_OnSave: function (executionContext) {
formContext = executionContext.getFormContext();
debugger;
var currentPreferredAddFlag = formContext.getAttribute("rcm_preferredaddressflag").getValue();
if (!SaveConfirmDialog) {
var confirmStrings;
executionContext.getEventArgs().preventDefault();
if (currentPreferredAddFlag == true) {
confirmStrings = { text: "The Preferred address Flag = Yes. Do you want to continue?", confirmButtonLabel: "Yes", cancelButtonLabel: "Cancel"};
}
else {
confirmStrings = { text: "The Preferred address Flag = No. Do you want to continue?", confirmButtonLabel: "Yes", cancelButtonLabel: "Cancel"};
}
confirmOptions = { height: 100, width: 200 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed) {
//Do something on click of OK.
formContext.data.entity.save();
SaveConfirmDialog = true;
}
else {
SaveConfirmDialog = false;
}
});
}
SaveConfirmDialog = false;
},
After Adding this code its working for save button to save the record. but for Save and close button It doesnt work its saving the record but not closing the form.
Can anybody suggest what is the problem?.