Script:
function DefineMaleFemale() {
var NRIC = Xrm.Page.getAttribute("vwlzs_identificationnum").getValue();
if (NRIC != null) {
var last = NRIC.charAt(NRIC.length - 1);
if (isEven(last) == true) {
Xrm.Page.getAttribute("vwlzs_gender").setValue(true); //Female
}
else {
Xrm.Page.getAttribute("vwlzs_gender").setValue(false); //Male
}
}
}
function isEven(value) {
if (value % 2 == 0)
return true;
else
return false;
}
No comments:
Post a Comment