to calculate duration
// get both dates from the form....
function Testing()
{
var start = Xrm.Page.getAttribute("new_staredate").getValue();
var end = Xrm.Page.getAttribute("new_enddate").getValue();
// to cancel the error when undefined
if (start==undefined || start==null || end==undefined || end==null) {
return;
}
// Get 1 day
var day=1000*60*60*24;
// Get time in days...
var time = ((end-start)/day)+1;
// Can't be less than 0.
if (time<0) time=0;
// Set the duration
Xrm.Page.getAttribute("new_noofdays").setValue(time);
}
Reference :-
Gangs036-MS-CRM-Blogspot: calculation of duration between two days in crm201...
// get both dates from the form....
function Testing()
{
var start = Xrm.Page.getAttribute("new_staredate").getValue();
var end = Xrm.Page.getAttribute("new_enddate").getValue();
// to cancel the error when undefined
if (start==undefined || start==null || end==undefined || end==null) {
return;
}
// Get 1 day
var day=1000*60*60*24;
// Get time in days...
var time = ((end-start)/day)+1;
// Can't be less than 0.
if (time<0) time=0;
// Set the duration
Xrm.Page.getAttribute("new_noofdays").setValue(time);
}
Reference :-
Gangs036-MS-CRM-Blogspot: calculation of duration between two days in crm201...
No comments:
Post a Comment