Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Error but still system allows SAVE

$
0
0

Hi All,

My idea is the system can't save the record until amount greater minimum sales price.

One of member in this community suggest me to do by 2 ways.
 
1. Change your event to OnSave -> it mean that you remove the OnChange event at amount field. Add to the OnSave, when user click Save, will call the getminimumsalespriceByProductId method to validate data.
If it meet condition, you do nothing, system will save it automatically.
 
2. If you do not allow user to save data, you just call Xrm.Page.context.getEventArgs().preventDefault();
 
I have test it, the error comeout but the system still allow the record to be save.
My coding is:
 

if (this.status === 200) {
var result = JSON.parse(this.responseText).d;
var name = result.Name;
var productNumber = result.ProductNumber;
var miniumprice = result.np_minimumsalesprice.Value;
if (miniumprice > amount ) {
alert("This amount is not valid. It cannot be lesser than" + " " + miniumprice);
}
}
else {
alert(this.statusText);
}


 
Someone please help me :(

Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images