Quantcast
Channel: Neil Parkhurst's Activities
Viewing all articles
Browse latest Browse all 1616

prevent save record through Javascript

$
0
0


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


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>