I am having an issue with a button that converts a Deal Object to an Opportunity Object.
The field I am using from Deal is '{!Deal_Registration__c.Close_Date__c}' which in this format returns 22/10/2014 .
The code I use is :
else
{
alert('{!Deal_Registration__c.Close_Date__c}');
var dealCloseDate = new Date ('{!Deal_Registration__c.Close_Date__c}');
alert(dealCloseDate);
newOpportunity.CloseDate =dealCloseDate;
}
When putting this in a date variable I get the alert
invalid date
and the error:
{faultcode:'soapenv:Client', faultstring:''NaN-NaN-NaNTNaN:NaN:NaN.NaN-NaN:NaN' is not a valid value for the type xsd:date', }
I have found a way around this by doing a substring and getting the month day year and setting a new date this way.. .but it seems a little overkill.
Does anyone have a suggestion on the proper way of getting this bit of code to work?
P.S. when looking at the field setup they both show as Date and not Datetime..
alert('{!Deal_Registration__c.Close_Date__c}');
?