Hi,
I replaced event.returnValue with getEventArgs().preventDefault() but it is not working. Please find below the scripts and screen-shots for you reference. It give error and save record. Please help to find solution.
function Form_onsave(executionOb)
{
if((Xrm.Page.getAttribute("new_accountid").getValue() != null ) &&
(Xrm.Page.getAttribute("new_name").getValue() == null ))
{
var results = GetRelatedcontacts();
if (results != 0)
{
alert("Technology details of this account is already in CRM. Please close this window and select existing record from view");
Xrm.Page.getAttribute("new_name").setValue() =null;
Xrm.Page.getControl("new_accountid").setFocus(true);
executionObj.getEventArgs().preventDefault();
}
}
}
It display the alert message and give below error but save record.
*This post is locked for comments