CRM 2013 YAŞ HESAPLAMA JAVASCRIPT

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("new_age").setValue(db.toString());

//var control1 = Xrm.Page.ui.controls.get("new_age");
//control.setDisabled(true);


}
}

Yorumlar

Bu blogdaki popüler yayınlar

CRM search can not find deactive records

Microsft CRM makale arama seçeneklerinin default değerini değiştirme