function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ashish855ashish855 

create task on click of custom button error

I receive following error on click of a custom button

 

missing;before statement

 

 

the custom button is created for creating a task automatically using the foll Javascript code:

 

{!REQUIRESCRIPT("("/soap/ajax/17.0/connection.js")} var t1= new sforce.SObject("Task"); t1.Assigned To = "r1free@fantailtech.com"; t1.Subject = "ABC283"; t1.Name = "abcd"; t1.Status = "Not Started"; t1.Priority = "Normal";result = sforce.connection.create([t1]);

Anand SinghAnand Singh
The code should look like this: {!REQUIRESCRIPT("("/soap/ajax/17.0/connection.js" )} var t1= new sforce.SObject("Task" ); t1.OwnerId = "SFDC ID of User with email r1free@fantailtech.com "; //instead of using label "Assigned To", use field API name called "OwnerId" t1.Subject = "ABC283"; t1.Name = "abcd"; t1.Status = "Not Started"; t1.Priority = "Normal"; result = sforce.connection.create([t1]); Hope this resolves the issue.