Tech Support > Microsoft Windows > Windows CRM > Java script help please - add 5 working days/add 5 days
Java script help please - add 5 working days/add 5 days
Posted by Ridhima Sood on June 8th, 2007


hi

I am trying to work with two dates on phone call entity in crm - actual
start and scheduledend

what i want to achieve is -
set the actual start date to current date if it is null and then
add 5 working days to actual start date

below is the code i am using

var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;

switch (crmForm.FormType)
{
case CRM_FORM_TYPE_CREATE:
crmForm.all.actualstart.DataValue == null
crmForm.all.actualstart.DataValue = new Date();
crmForm.all.scheduledend.DataValue=dateadd("w",5,a ctualstart)
break;
case CRM_FORM_TYPE_UPDATE:
//crmForm.all.scheduledend.DataValue == null
// crmForm.all.scheduledend.DataValue = new Date ();
break ;
}

thanks heaps in advance

Regards
Ridhima

Posted by uMar Khan on June 8th, 2007


Hi Ridhima Sood,
The following piece of code will set the scheduled end date to today+5.

/////////////////////////////////////////
var currentDate = new Date();

var startDate = new Date(
currentDate.getYear(),
currentDate.getMonth(),
currentDate.getDate()+5,
currentDate.getHours(),
currentDate.getMinutes(),
currentDate.getSeconds());

crmForm.all.scheduledend.DataValue = startDate;

///////////////////////////////////////////
--
PLEASE do click on Yes or No button if this post was helpful or not for our
feedback.

uMar Khan
Email for direct contact: imumar at gmail dot com


"Ridhima Sood" wrote:

Posted by Peter Lynch on June 9th, 2007


This code adds 5 days, not 5 working days as required

The requirement is not trivial. To start with, how are working days defined?


"uMar Khan" <imumar@gmail.com> wrote in message
news:BD675DF3-A8E1-4C9E-8E04-25ADF87C94F3@microsoft.com...


Posted by uMar Khan on June 10th, 2007


Hi,
Following URL will help you;
http://www.stunnware.com/crm2/topic.aspx?id=JS3

--
PLEASE do click on Yes or No button if this post was helpful or not for our
feedback.

uMar Khan
Email for direct contact: imumar at gmail dot com


"Peter Lynch" wrote:


Similar Posts