I use the following condition to check a,b values before save.And I call this function form's onsave Event.
if the field values a == b means i need to save the record.Else I need to show the alert.
if a!= b condition the infinite loop will occur which means the alert message shows continuously .My problem is i need to prevent save record if(a!=b) . I used eventArgs.preventDefault(); but its not working.
Am working in CRM 2016.
function onsavecall()
{
if(a != b)
{
alert("alert a is not equal to b .so please change value B");
}
else
{
Xrm.Page.data.save.then(function(){
Xrm.Page.data.refresh();
});
}
}
Thanks in Advance