• jingyuan xie 6
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi ,I'm trying to create a custom button in leads detail page that when clicked will populate a custom field called attampt date 1 with the current date. The attempt date 1 field is set up as a date field,and JS like this,but when clicked the button,it returned an error message like "A problem with the OnClick JavaScript for this button or link was encountered:expected token="
Can anyone help to find out the reason , thanks!!!

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 

var newRecords = []; 

var c = new sforce.SObject("lead"); 
c.id ="{!Lead.Id}"; 
c.{!Lead.attempt1_date__c} = new Date().toISOString(); 
newRecords.push(c); 

result = sforce.connection.update(newRecords); 

window.location.reload();
Hi ,I'm trying to create a custom button in leads detail page that when clicked will populate a custom field called attampt date 1 with the current date. The attempt date 1 field is set up as a date field,and JS like this,but when clicked the button,it returned an error message like "A problem with the OnClick JavaScript for this button or link was encountered:expected token="
Can anyone help to find out the reason , thanks!!!

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 

var newRecords = []; 

var c = new sforce.SObject("lead"); 
c.id ="{!Lead.Id}"; 
c.{!Lead.attempt1_date__c} = new Date().toISOString(); 
newRecords.push(c); 

result = sforce.connection.update(newRecords); 

window.location.reload();