• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 647
  • Last Modified:

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

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
logicsolutions
Asked:
logicsolutions
1 Solution
 
logicsolutionsAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now