Solved

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

Posted on 2011-03-15
1
642 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

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.

Question has a verified solution.

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

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…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

687 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