Solved

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

Posted on 2011-03-15
1
641 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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