You need to sign in to do that
Don't have an account?
Anthony Penketh
Issues with custom buttons on the lead page.
Hi All,
I am trying to create a custom button ("LVM") on the lead object that will create a task, applied the current date and sets the status to complete.
Here's what I have so far:
{!REQUIRESCRIPT("/soap/ajax/17.0/connection.js" )}
var t1= new sforce.SObject("Task");
t1.Subject = "LVM";
t1.Status = "Completed";
t1.Priority = "Normal";
t1.OwnerId = "{!User.Id}";
t1.ActivityDate = new Date();
result = sforce.connection.create([t1]);
if(result[0].success=='true'){
alert('Your Left voice mail (LVM) task has been created.');
location.reload();
}
else
{
alert(result[0]);
}
This currently delivers the alert but does not create the task.
Origionally we used the following:
t1.WhatId = "{!Lead.Id}";
But received and error message upon pressing the button.
Any help would be much appreciated!
Thanks,
Anthony
I am trying to create a custom button ("LVM") on the lead object that will create a task, applied the current date and sets the status to complete.
Here's what I have so far:
{!REQUIRESCRIPT("/soap/ajax/17.0/connection.js" )}
var t1= new sforce.SObject("Task");
t1.Subject = "LVM";
t1.Status = "Completed";
t1.Priority = "Normal";
t1.OwnerId = "{!User.Id}";
t1.ActivityDate = new Date();
result = sforce.connection.create([t1]);
if(result[0].success=='true'){
alert('Your Left voice mail (LVM) task has been created.');
location.reload();
}
else
{
alert(result[0]);
}
This currently delivers the alert but does not create the task.
Origionally we used the following:
t1.WhatId = "{!Lead.Id}";
But received and error message upon pressing the button.
Any help would be much appreciated!
Thanks,
Anthony
Use this:
t1.WhoId = LeadId;
And what the error you are getting?
Mark this as solution if works.
All Answers
Use this:
t1.WhoId = LeadId;
And what the error you are getting?
Mark this as solution if works.