You need to sign in to do that
Don't have an account?
Sunil
How to store current date into custom date field at Opportunity Object
Hi,
I am trying to store current date into one of the custom date field at Opportunity object. I am using the code below: -
Code:
I am getting error "05/09/2007' is not a valid for the type 'xsd:date'. Any idea where I am doing mistake? Do you have any example of updating date field?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/9.0/connection.js"></script> <script language="javascript"> function saveRec() { var opp = new sforce.SObject("Opportunity"); opp.set("Id", "{!Opportunity.Id}"); var mydate=new Date() var year=mydate.getYear() if (year < 1000) year+=1900 var day=mydate.getDay() var month=mydate.getMonth()+1 if (month<10) month="0"+month var daym=mydate.getDate() if (daym<10) daym="0"+daym var date1=month+"/"+daym+"/"+year; // this returns eg. 05/09/2007 opp.set("Questionnaire_Back__c",date1);
I am getting error "05/09/2007' is not a valid for the type 'xsd:date'. Any idea where I am doing mistake? Do you have any example of updating date field?
Thanks in advance.
You can assign a javascript Date to the field and the toolkit will convert it to
the correct xml string.
HTHs,