I'm going through one of the Force.com workbooks and attempting to add some functionality to a Date field using a custom button.
On click, I want to button to update the appropriate field by moving the Date a year forward. Here is my code:
{!requireScript("/soap/ajax/37.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Invoice Statement");
c.id ="{!Invoice_Statement__c.Id}";
c.{!Invoice_Statement__c.Contract_Date__c} = new Date();
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();
Can someone point me in the right direction of what I'm doing wrong here? most of the things I've tried have resulted in an "Unexpected number" error.