Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

seeing created on date , due date should auto populate to 30 days

$
0
0


//Get Created On date to build Due Date
if (Xrm.Page.getAttribute('createdon').getValue());
{

dueDate = Xrm.Page.getAttribute('createdon').getValue();

}

if (hourSLA) {
if (hourSLA % 11 == 0) {
var daysToAdd = (hourSLA / 11);
dueDate = correctTheHours(dueDate, eod, sod);
addDays(dueDate, daysToAdd);
} else {
var hoursToAdd = hourSLA % 11;
dueDate.setHours(dueDate.getHours() + hoursToAdd);
dueDate = correctTheHours(dueDate, eod, sod);

//Get the days to add via subtracting the extra hours from the total hours and dividing that result by 12 to get
the days to add.
var daysToAdd = ((hourSLA - hoursToAdd) / 11);
dueDate = addDays(dueDate, daysToAdd);
dueDate = CheckForSkipDays(dueDate);
}
} else if (daySLA) {
//Correct the hours so it is within the business day
dueDate = correctTheHours(dueDate, eod, sod);

//Add the days!
dueDate = addDays(dueDate, daySLA);
}

return dueDate;
}

-------------------------------------------------------

//If hours are before or after business hours, set to next day + hours past end of business day
function correctTheHours(dueDate, eod, sod) {

if (dueDate.getHours() >= eod) {
//
dueDate.setHours(sod + (dueDate.getHours() - eod));
dueDate.setDate(dueDate.getDate() +1);

} else if (dueDate.getHours() < sod) {

dueDate.setHours(sod + (24- eod) + dueDate.getHours());

}

return dueDate;
}


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>