This is driving me crazy. I have a script on the Contract entity that is supposed to fire onChange for one date field (activeon) and then set the value of another date field (expireson) depending on the selected value of a picklist (new_contractterm). No matter what I change, I keep getting:
Here's the script in question:
function OnChange_EffectiveDate(){
var effDate = new Date(Xrm.Page.getAttribute('activeon').getValue());
var term = Xrm.Page.getAttribute('new_contractterm').getValue();
if (effDate != null) && (term != null) {
if (term == 100000000) {
var termDate = effDate.setFullYear(effDate.getFullYear() + 100);
Xrm.Page.getAttribute('expireson').setValue(termDate);
}
else if (term == 100000001) {
var termDate = effDate.setFullYear(effDate.getFullYear() + 1);
Xrm.Page.getAttribute('expireson').setValue(termDate);
}
else if (term == 100000002) {
var termDate = effDate.setFullYear(effDate.getFullYear() + 2);
Xrm.Page.getAttribute('expireson').setValue(termDate);
}
else if (term == 100000003) {
var termDate = effDate.setFullYear(effDate.getFullYear() + 4);
Xrm.Page.getAttribute('expireson').setValue(termDate);
}
else if (term == 100000004) {
var termDate = effDate.setFullYear(effDate.getFullYear() + 5);
Xrm.Page.getAttribute('expireson').setValue(termDate);
}
}
}
If anyone can help me out before I put a fist through my monitor, I'd greatly appreciate it.
*This post is locked for comments
I have the same question (0)