All, I am trying to use javascript to setValue a integer into a field based on the dates in a start and end field. I’m not even sure what the correct syntax for finding the day of the week with CRM javascript. Here is my code so far.
function netbdays_change() {
var startday = Xrm.Page.getAttribute("new_quotestart").getValue();
var endday = Xrm.Page.getAttribute("new_quoteend").getValue();
cycletime = endday - startday;
Xrm.Page.getAttribute("new_setcycletime").setValue(cycletime);
}
Try this:
getDay() returns a 0 based representation of the day of the week.
http://www.w3schools.com/jsref/jsref_getday.asp
If you want to calculate the number of days between 2 dates, try this: