• pasmith
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I want users of the system to be able to push a button on a Lead record to create and associate a task with fields already populated. I am able to create the button and place it where it needs to be. My problem is with the onclick javascript code. When the button is pressed with the code below, nothing happens. Please let me know how I can accomplish this.

Here is my code:

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

var task = new sforce.SObject("Task");
task.RecordType = "Custom Record Type";
task.Status = "Not Started";
task.Subject = "CustomLabel: " + "{!Lead.Company}" + "{!Lead.LastName}";
task.WhoId= "{!Lead.Id}";

var result = sforce.connection.create([task]);


I want users of the system to be able to push a button on a Lead record to create and associate a task with fields already populated. I am able to create the button and place it where it needs to be. My problem is with the onclick javascript code. When the button is pressed with the code below, nothing happens. Please let me know how I can accomplish this.

Here is my code:

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

var task = new sforce.SObject("Task");
task.RecordType = "Custom Record Type";
task.Status = "Not Started";
task.Subject = "CustomLabel: " + "{!Lead.Company}" + "{!Lead.LastName}";
task.WhoId= "{!Lead.Id}";

var result = sforce.connection.create([task]);