• Catherine Cruz
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,

I would like to create a jscript button to clear two fields in an opportunity when pressed.
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject("Opportunity"); 
c.id ="{!Opportunity.Id}"; 
c.Task_Due__c = " ";
c.Task_Notes__c = " ";
newRecords.push(c); 
result = sforce.connection.update(newRecords); 
window.location.reload();

Above is the code I am trying but I just get error messages. The Task_Due and Task_Notes are the custom fields I am trying to reset to empty. Task Due is a date field and Task Notes is a long text field.

Anyone have any ideas on what is wrong or what needs correcting?

Thanks,
Pete