Java script help please - add 5 working days/add 5 days

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,actualstart)
        break;
case CRM_FORM_TYPE_UPDATE:
        //crmForm.all.scheduledend.DataValue == null
       // crmForm.all.scheduledend.DataValue = new Date ();
       break ;
}

thanks heaps in advance

Regards
Ridhima
0
Utf
6/8/2007 4:08:02 AM
crm 35858 articles. 1 followers. Follow

3 Replies
694 Views

Similar Articles

[PageSpeed] 26

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:

> 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,actualstart)
>         break;
> case CRM_FORM_TYPE_UPDATE:
>         //crmForm.all.scheduledend.DataValue == null
>        // crmForm.all.scheduledend.DataValue = new Date ();
>        break ;
> }
> 
> thanks heaps in advance
> 
> Regards
> Ridhima
0
Utf
6/8/2007 1:15:01 PM
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...
> 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:
>
>> 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,actualstart)
>>         break;
>> case CRM_FORM_TYPE_UPDATE:
>>         //crmForm.all.scheduledend.DataValue == null
>>        // crmForm.all.scheduledend.DataValue = new Date ();
>>        break ;
>> }
>>
>> thanks heaps in advance
>>
>> Regards
>> Ridhima 


0
Peter
6/9/2007 9:35:58 PM
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:

> 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...
> > 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:
> >
> >> 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,actualstart)
> >>         break;
> >> case CRM_FORM_TYPE_UPDATE:
> >>         //crmForm.all.scheduledend.DataValue == null
> >>        // crmForm.all.scheduledend.DataValue = new Date ();
> >>        break ;
> >> }
> >>
> >> thanks heaps in advance
> >>
> >> Regards
> >> Ridhima 
> 
> 
> 
0
Utf
6/10/2007 6:26:00 AM
Reply:

Similar Artilces:

when word is used as mail editor in outlook, the commandbars are not getting add
Hi, I have written a Com Add-in which adds a new Commandbar to the New Mail window. I am using the NewInspector event to place a Commandbar with buttons on a new mail Inspector window , I.e. Whenever New Mail message window is opened. I have created a new commandbar and aded a new commandbutton on that newly created commandbar. Everything is working fine if i use HTML as mail editor. If i use word as the default mail editor in outlook, then the commandbar is not getting added and also the buttons. Could someone please suggest me what i should do to add the commandbars to the word mai...

Help with Rules Please!
I have a quick question with the rules setup in outlook 2003. I love the Spam (Trash) filter in this program. My only issue is, I can't seem to use it with my current set of rules. I currently manage about 5 email account (a fax server, three separate work accounts and a personal account). Now, when I setup the rule: Apply this rule after the message arrives Through the WORK ACCOUNT A Move it to the WORK A folder This all works great, only it also applies it to all junk mail as well as mail that goes into my inbox. So here in my dilemma: How do I get the rules to send al...

conditional format text
If I have one cell - d32, and when the value becomes negative I want cell E32 to say "Over Budget", would this be possible? Not entirely sure what you are asking... but see if this helps. In E32 =IF(D32<0,"Over Budget","") George Gee "Vivek" <Vivek@discussions.microsoft.com> wrote in message news:7303B46C-AD91-428A-8B87-D9542F899C50@microsoft.com... > If I have one cell - d32, and when the value becomes negative I want cell > E32 > to say "Over Budget", would this be possible? It works, thanks a lot! I also wa...

cannot add user into Active Directory via c#.net
My System Have 2 Computer: Frist Computer act as A domain Controller that has a Active Directory,RADIUS Server,DHCP and DNS Second Computer act as A Web Server(join domain with a first computer already) and use Microsoft Visual Studio Team System 2008 I create a website on a second computer to add user in active directory. I have 3 file: 1.Default.aspx - Let user fill their privacy information 2.ViewRegisterdata.aspx - Let user confirm their information before it's added to active directory. In this file,there is a Viewregisterdata.aspx.cs which collect user information...

how to Converts a number to english text and adds a suffix of "do. #3
how to Converts a number to english text and adds a suffix of "dollar"? Hi see: http://www.xldynamic.com/source/xld.xlFAQ0004.html >-----Original Message----- >how to Converts a number to english text and adds a suffix of "dollar"? >. > ...

need cell validation formula help
I need some assistance with creating a formula to use in validating cells on a time card worksheet. Here is what I need: For a particular day, the sick,vacation, and personal time entered can not make the total hours for the day more than 8. for example, if I work 8 hours today, I can not enter any of the other time. Or if I only work 4 hours today, I can only have up to 4 hours of other time. I already have a rule that will not allow the total number of sick, vaction, and personal time not sum to be more than 8 hours a day. Can someone help me please? ...

i want to plot a frequency spectrum.HELP!!!!!!!!!!!!!
I have to plot a frequency spectrum chart. The problem is that the frequency is not a specific number its a range like 5.0051MHz to 5.0689Mhz has power of 10mWatt . how can it be done Not too sure I understand the problem. You must make an XY chart not a Line chart best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Salman" <Salman@discussions.microsoft.com> wrote in message news:CC271F42-0BFB-4229-8A54-302C9423212C@microsoft.com... >I have to plot a frequency spectrum chart. The problem is that the >frequenc...

Using RMS Journal viewer from add on
Does anyone know how to call/use RMS Journal viewer from executable add-on? My problem is, that I have to generate a new sale transaction (summary of different sales from one period) and after that I need to print that document,but I Can't find a way how to do that. Ene Hi Ene, You can do so if you have Transaction column added in your report. click on Hide/UnHide column and Check Transaction column then whenever you click the Transaction ID a hover glass will come just double click it will jump you to the Journal viewer. I hope this will help you. Rate me please. "Ene&qu...

Add new company Crash
hi I use GP 10,while adding new company through gp ultilies it reach to creating company information then GP utiliites crash what shall i do thank you in advance It might be due to some corrupted records in your existing tries of other companies, try to check tables in you Dynamics database and make sure that only records related to your companies are exist. Regards, -- Mohammad R. Daoud MVP, MCP, MCBMSP, MCTS, MCBMSS Mob: +962 - 79 -999 65 85 mohdaoud@gmail.com http://mohdaoud.blogspot.com/ "New User" wrote: > hi > I use GP 10,while adding ...

Help about image transfer to excel spread sheet
Hi there, can any one tell me how to use csaned image in to excel, particularly am concerned about reconciliations, have many paper account statements and will be of great help if i can scan these documents and get it into Excel sheets. -- Ali. You will need to use OCR software, and won't get any formatting or formulas, just values...... Vaya con Dios, Chuck, CABGx3 "Ali Noor" wrote: > Hi there, > > can any one tell me how to use csaned image in to excel, particularly am > concerned about reconciliations, have many paper account statements and will > ...

Need HELP!
I need a way to import purchase orders into RMS. Most of my vendors do on-line ordering, and I receive a file (that I can convert to text), of what what ordered. I want to be able to import this to RMS so I can see what's on order, and to make receiving easier. SURELY someone has done this. Please help. My staff is spending HOURS doing duplicate entry because of the online order and then having to put it in RMS. tracy@premium-pet.com Retail Realm has a tool to import PO's but I've never used it so I don't know how well it works. There might be other RMS Addon De...

Add Items to MSFlexGrid
Hi, I need to add items into the MSFlexGrid control in background. Means I need to add 1 lakh records to my MSFlexGrid Control, but it is taking 10 min. to fill the data. So, I have placed the filling functionality into the worker thread and now I can able to work with MSFlexGrid. But when I scroll or click on the control it is displaying major error and the application shuts down. How can I solve this problem? I am expecting the solution which inserts the data of MSFlexGrid in background while I am using the MSFlexGrid in front end. Please give the solution ASAP... K.VenkataRamana wro...

SP-2 Install Update Failing
Hi, I am trying to update SP-2 for Outlook 2002. I already have SP-1. When I go to install the install program gets stuck and says I have to insert the Office XP disk to get something for Frontpage. I never got a disk with my computer to even put it in. Please help! Thanks Brandon ...

How do I create a macro to add contacts from email messages?
I'm trying to add all the senders to my current email address to my contacts. I want to create a macro to do this but I'm a serious newbie to Visual Basic. How can I do this? What's the code? If you want to do that when receiving an email, see the ItemAdd event of the Inbox (there's an example in the VBA help file). And for sent item see the ItemSend event of the Application object. In that events you can either read the SenderEmailAddress property, or all the addresses from the Recipients collection. For creating a contact see the CreateItem function. You co...

Access Help
I have a problem , I need to allow a group of people to select the books they want to purchase , then I want to print a report showing how many of a particular book I need to buy and then show a chart refelcting how many of the diffrent books were chosen. Can anyone please help me is this done in a query or report ??? "NicholasEllis" <nicholasjohnmillsellis@gmail.com> wrote in message news:1188030573.194969.188530@x40g2000prg.googlegroups.com... >I have a problem , I need to allow a group of people to select the > books they want to purchase Use a query based form &...

Need help understanding passing pointers between threads.
Need help understanding passing pointers between threads. The code below works but if I uncomment the ASSERT_VALID() line, the assertion fails with a warning about passing pointers between threads. I only vaguely understand this. How do I do it right? (The code is simplified for this post) TIA, Harvey class CXThread { public: CXThread(); // Attributes protected: class CMyDoc *pDoc; void FillXInfo(); static UINT ThreadFuncX(LPVOID); // Etc. }; void CXThread::StartXThread(CMyDoc *pdoc) { pDoc = pdoc; // @@ is this supposed to be dangerous? pThread = AfxBeginThread(ThreadFuncX,this,T...

Add 0 for hour in hh:mm:ss format
I have a column of times formatted to hh:mm:ss. However the data i exported from a database table. When it comes in the data does no always have a value for the hours digit. Here is an example of my dat [ :10:48 ] and [ 1:28:53 ] if the time was 10 minutes and 48 second there is no place holder of 0 for the hours but if the time is 1 hou 28 minutes and 53 seconds, the place holder is 1. I need to be able t format my fields so that a zero fills in if the time is less that hour. I have tried custom formating but can not seem to get Excel t add a zero as a place holder. We are having to manuall...

please wait while microsoft outlook exits
In Outlook 2000, keep getting the above message when trying to exit from Outlook 2k. Re-installed, but no difference. Any assistance would be appreciated. ...

Help with internet explorer
I have a new dell computer with windows seven. When I call up my home page Yahoo, the contents of the page doesn't fill the screen left to right, it's centered and small but the tool bars at the top are large. What can I do to fix this? Hi, Right-click the IE toolbar and verify that Status Bar is checked then check the Zoom setting at the right end of the Status Bar (bottom of the IE window.) I Internet Options> Advanced> Accessibility, if you check "Reset zoom level for new windows and tabs," all windows and tabs should open with this zoom setting. - H...

Mouse in KVM stopped working
Hi: I've been using KVM, 'MiniView 4-port KVM' for about six months for four different PCs, but mostly I've been using only 2 PCs a day although I did hook it up with four PCs to KVM. This morning I found both 'mouse and keyboard' stopped working to all four PCs. Monitor/Screen is all OK, crisp and clear. Also, all connections are in perfect shape. When I turned on one of PCs, a buzzing noise. At first, the PC going bad? , .... but when I took off 'mouse' connected with KVM, noise ceased. Afterwards, both mouse and keyboard does not respon...

Using Word in Outlook not working
All of a sudden when I try to write a new e-mail message I get an error saying: "Microsoft Word is set to be your e-mail editor. However, Word is unavailable, not installed, or is not the same version as Outlook. The Outlook e-mail edito will be used instead. The program for the attachment may not have been installed properly or may have been moved or deleted. Reinstall the program in which the attachment was created." I don't understand what it's talking about about attachment. The version of Office is 2003 all the way around, and it was working yesterday. Is this a known...

Excel reset colors does not work.
I want to change the colors back to their original color. I went in to tools, clicked options, clicked the colors tab and then clicked reset and nothing happened. The colors are still not what they were before I changed them. Reset changes the colors to the default palette. Did you have an already customized palette? Palettes are workbook-specific. Changes in one workbook won't affect others. In article <E09A16FE-B64E-4E34-835A-2D78B59193D7@microsoft.com>, jackdaddy <jackdaddy@discussions.microsoft.com> wrote: > I want to change the colors back to their origina...

How can I recover lost work in Office Publisher
How did you lose it? -- JoAnn Paules MVP Microsoft [Publisher] "Penicuik" <Penicuik@discussions.microsoft.com> wrote in message news:AECD84EB-16ED-4C8A-9EFC-29042A2F09FC@microsoft.com... > Lost, as you didn't save it? Or lost because you can't open the publication? In Windows Explorer, type %temp% in the address bar, look for any temp file with a pub prefix, change the .tmp to .pub. You may get lucky. How to troubleshoot a damaged publication in Publisher http://support.microsoft.com/kb/198256/en-us -- Mary Sauer MSFT MVP http://office.microsoft.c...

Lost E-Mail from WinE-Mail to Outlook2007 HELP!!!!
I have 32bit Vista. Came with "Windows Mail". Installed Outlook 2007 and now my old E-Mails are GONE! Help!!! Should I sys restore and back up? Is there a file I need to find? What's the dang solution?! D wrote: > I have 32bit Vista. Came with "Windows Mail". Installed Outlook 2007 and now > my old E-Mails are GONE! Help!!! Should I sys restore and back up? Is there a > file I need to find? > > What's the dang solution?! What do you mean "your emails are gone"? Outlook does NOT overwrite Windows mail. Your emails are STILL in Window...

CHTMLView help needed
I have a CHTMLView and I want to save the output from it as a bitmap (or some other image type) file. Does anyone know how to render the content of the view to an image file (IE5.5 and up)? The normal standard Windows GDI based approach doesn't seem to work because it only gets the area of the view that is visible and includes the view's scroll bars in the output. Is there away to get cleaner output rendered to an impage file that doesn't have the scroll bars and shows the whole content, not just what is currently visible onscreen? ---------------------------- I know one of you ...