I have 4 fields that I'd like to set a default date for so decided to use javascript rather than 4 business rules.
My javascript is giving the error "nowDate.getDate is not a function at SetDefaultDates"
My javascript:
function SetDefaultDates() {
console.log("Set Default Dates");
console.log("End Dates: now + 90 days");
var daysToAdd = 90;
var nowDate = Date.now();
console.log(nowDate);
var endDate = new Date().setDate(nowDate.getDate() + daysToAdd);
console.log(endDate);
if (Xrm.Page.getAttribute("cld_billingstartdate").getValue() == null)
Xrm.Page.getAttribute("cld_billingstartdate").setValue(Date.now());
if (Xrm.Page.getAttribute("cld_billingenddate").getValue() == null)
Xrm.Page.getAttribute("cld_billingenddate").setValue(endDate);
if (Xrm.Page.getAttribute("cld_licencestartdate").getValue() == null)
Xrm.Page.getAttribute("cld_licencestartdate").setValue(Date.now());
if (Xrm.Page.getAttribute("cld_licenceenddate").getValue() == null)
Xrm.Page.getAttribute("cld_licenceenddate").setValue(endDate);
}
What is the best way to resolve this? This is CRM Online 8.2 currently.
*This post is locked for comments
I have the same question (0)


Report
All responses (
Answers (