You need to sign in to do that
Don't have an account?
javascript button error
I am getting the following error when I try configuring a JavaScript button, which should create a Task record

This is my script
{!REQUIRESCRIPT('/soap/ajax/30.0/connection.js')}
var connection = sforce.connection;
var newtask= new sforce.SObject("Task");
newtask.Subject = "Tried Calling";
newtask.WhoId="{!Lead.Id}";
newtask.Description="Tried calling, but could not get through";
newtask.ActivityDate={!Today}
newtask.Status="Completed";
newtask.Type="Admin Call";
newtask.Priority="Low";
result = sforce.connection.create([newtask]);
alert(result );
I am a total beignner at this, so have copied and amended this script based on other posts
This is my script
{!REQUIRESCRIPT('/soap/ajax/30.0/connection.js')}
var connection = sforce.connection;
var newtask= new sforce.SObject("Task");
newtask.Subject = "Tried Calling";
newtask.WhoId="{!Lead.Id}";
newtask.Description="Tried calling, but could not get through";
newtask.ActivityDate={!Today}
newtask.Status="Completed";
newtask.Type="Admin Call";
newtask.Priority="Low";
result = sforce.connection.create([newtask]);
alert(result );
I am a total beignner at this, so have copied and amended this script based on other posts
Please update your code with the below code :
I have tried the above code in my org and it is working as expected.
Please let me know if you face any issue with the above code.
Thanks,
Abhishek Bansal.
All Answers
Please check the below post:
http://salesforce.stackexchange.com/questions/44988/javascript-button-date-to-date-nan-error
Regards,
Mahesh
Please update your code with the below code :
I have tried the above code in my org and it is working as expected.
Please let me know if you face any issue with the above code.
Thanks,
Abhishek Bansal.
I hadn't realised what the alert(result) command did, so I removed that and also added a location.reload() command on the end to refresh the page