Description:
In this example we explain that how to calculate age
based on date of birth in dynamic crm using javascript.Auto Calculate Age based
on Date of Birth in Dynamic CRM using javascript.i need to suto calculate age
of the customer (contact entity) based on date of the birth.in this example
when user change the date of birth at that time the age of the
customer(contact) will be automatically calculated onchange of the date of
birth event using javascript in dynamic crm.
you have to call this function on onload of the form
& onchange of the birthdate so you can dynamically calculate your age as
per birthdate.
Script:
function
SetAge(birthdate) {
var
birthd = Xrm.Page.getAttribute("birthdate").getValue();
if
(birthd == null) {
return;
}
var
today = new Date().getFullYear();
year1 = birthd.getFullYear();
Xrm.Page.getAttribute("new_age").setValue(today - year1);
}
0 comments:
Post a Comment