everyone.
I'm attempting to institute an OnClick Javascript button which increases the StartDate and EndDate fields of the standard Contract object by one year (essentially renewing it), but continually receive an "Invalid or Unexpected Token" error. Here is the code below:
{!requireScript("/soap/ajax/37.0/connection.js")}
{!requireScript("/soap/ajax/37.0/apex.js")}
var newRecords = [];
var c = new sforce.SObject("Contract");
c.id ="{!Contract.Id}";
c.StartDate = new Date("{!YEAR(Contract.StartDate) + 1},
{!MONTH(Contract.StartDate)},
{!DAY(Contract.StartDate)}");
c.EndDate = new Date("{!YEAR(Contract.EndDate) + 1},
{!MONTH(Contract.EndDate)},
{!DAY(Contract.EndDate)}");
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();
This code was working with a custom object in my developer organization, but doesn't seem to work on the standard Contract object.