You need to sign in to do that
Don't have an account?
pasmith
trying to create task with fields populated on a lead record
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]);
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]);
something ilke
alert(saveResult.toString())
Record type needs to be RecordTypeId i.e.
var t=new sforce.SObject("Task"); t.RecordTypeId = "012200000008o5z"; t.Status = "Not Started"; t.Subject = "Subject Text"; t.WhatId= "{!Account.Id}"; var result = sforce.connection.create([t]);