This is the function
processRetrievedInvoices : function(result, formContext,executionContext)
{
debugger;
try {
if (result !== null && result !== undefined) {
if (result.entities !== null && result.entities !== undefined) {
if (result.entities.length > 0) {
//var saveEvent = executionContext.getEventArgs();
// Xrm.Navigation.openErrorDialog({ errorCode:"ABC7123", details:"These are the details that will go into the downloaded file", message:"Here's the message" }).then( function (success) {
// console.log(success);
// },
// function (error) {
// var eventArgs = executionContext.getEventArgs();
// eventArgs.preventDefault();
// console.log(error);
// });
var message = "Invoice Number " +invoiceNumber + " already exists. Please enter correct Invoice Number. ";
var type = "WARNING"; //INFO, WARNING, ERROR
var id = "101"; //Notification Id
var time = 20000; //Display time in milliseconds
//Display the notification
Xrm.Page.ui.setFormNotification(message, type, id);
//Wait the designated time and then remove the notification
//setTimeout( function () {Xrm.Page.ui.clearFormNotification(id);}, time );
//alert("Invoice Number" +invoiceNumber + " already exists. Please enter correct Invoice Number. ");
var eventArgs = executionContext.getEventArgs();
alert(eventArgs.getSaveMode());
if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 1) //manual save or Xrm save
{
eventArgs.preventDefault();
}
}
}
}
} catch (e) {
Xrm.Utility.alertDialog(e.message);
}
},