function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
len123len123 

Update Date Field Using S-Control

Hello,
 
I am using the Quotes appexchange and there is there Scontrol that I am trying to update that will copy details from the quote to the opportunity when copying the quote lines. From some reason it's working well with 2 text fields (Country Code and Additional Ref) but with date fields (Valid Until and presented Date) it's not working and there is an error. All the fields are customized. Here is the code, any suggestions:
 
Code:
function copyQuoteDetailsToOpp() 
{ 
var oppid = "{!SFDC_520_Quote__c.OpportunityId__c}"; 
var countryCode= "{!SFDC_520_Quote__c.Country_Code__c}"; 
var additionalRef = "{!SFDC_520_Quote__c.Additional_Ref__c}"; 
var presentedDate = "{!SFDC_520_Quote__c.Presented_Date__c}"; 
var validUntil = "{!SFDC_520_Quote__c.Valid_Until__c}"; 
var oppInfo = new Sforce.Dynabean("Opportunity"); 
oppInfo.set("Id", oppid ); 
oppInfo.set("Country_Code__c", countryCode); 
oppInfo.set("Quote_Additional_Ref__c", additionalRef ); 
oppInfo.set("Quote_Presented_Date__c", presentedDate ); 
oppInfo.set("Quote_Valid_Until__c", validUntil ); 
var sa = sforceClient.Update([oppInfo])[0]; 
} 

 
jpizzalajpizzala
What is the error you are getting? What format are the dates in when you assign them to the Opportunity fields?

I've noticed that unless the dates are in YYYY-MM-DD format when updating records, Salesforce doesn't recognize them appropriately.

HTH