Solved

Unable to perform addition of Picklist Value to Date field in MS Dynamics CRM 4.0

Posted on 2011-03-15
1
637 Views
Last Modified: 2012-05-11
Hi Experts,

I have the following situration:

1. Field A = Date Field
2. Field B = Picklist with values ranging from 1 to 28
3. Field C = Date Field

I would like to do the following

1. When Field A (Date) is chosen and also Field B (Picklist Value) is selected than it will add the picklist value as "days" to field A and output it as Date in Field C

I currently have the following code.

** Note ** The date format is DD/MM/YYYY

The problem is though when ever I use the following code if I select for example 01/12/2011 in Field A and Picklist option with Value 2 I get the following date: 12/12/2011.

All it's doing is joining the picklist value to the first number.

Appreciate your help experts!
var _Date=new Date(crmForm.all.new_serviced_date.DataValue);
var _Day=_Date.getDate();
var _Interval=crmForm.all.new_serviceinterval.DataValue;
_Date.setDate(_Day+_Interval);
crmForm.all.new_serviceduedate.DataValue=_Date;

Open in new window

0
Comment
Question by:logicsolutions
1 Comment
 
LVL 1

Accepted Solution

by:
logicsolutions earned 0 total points
ID: 35139287
Here is how I did it. You can not add two variables together using the additive sign withoutmfirst declaring the variablemas a number.
var _Date=new Date(crmForm.all.new_serviced_date.DataValue);
var _Day=_Date.getDate();
var _Interval=crmForm.all.new_serviceinterval.DataValue;
_Date.setDate(Number(_Day)+Number(_Interval));
crmForm.all.new_serviceduedate.DataValue=_Date;

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is a walkthrough guide I wrote whilst upgrading my on-premise MS Dynamics CRM 3.0 deployment to 4.0. This covers the actual installation of the product to a working level for my system, I ran into a lot of issues that the steps below fixed so h…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now