Microsoft Dynamics CRM yaş Hesaplama (calculate age)
function Age() { if(Xrm.Page.getAttribute("birthdate").getValue() != null) { var DOB = Xrm.Page.getAttribute("birthdate").getValue(); var Today = new Date(); Today.setHours(0, 0, 0, 0); var db = 0; if(DOB > Today ) { alert("Please Enter Genuine BirthDate !!!"); Xrm.Page.getAttribute("birthdate").setValue(null); } else { db = Today.getFullYear() - DOB.getFullYear(); var x = Today.getDate() ; var y = DOB.getDate() ; var a = Today.getMonth() + 1; var b = DOB.getMonth() + 1; if((a < b) || (a==b & x < y)) db=db - 1; } Xrm.Page.getAttribute("bm_age").setValue(db.toString()); //var control1 = Xrm.Page.ui.controls.get("bm_age"); //control.setDisabled(true); } }