I have a url custom button on the Lead and Contact record. It creates a completed task on that record. However, I would like it so that when I click on the button, called "Log a Visit", the screen simply reloads instead of taking me to the Task page to save. Is this possible without using Visualforce?

Below is the button details for the Lead record:

tsk5=Walk-In Visit&
  • 1
    do you want a task to be created related to a lead with no data entry and no visualforce?You can go ajax route its not visualforce but definitely coding is involved – Rao Feb 20 '14 at 23:18

There is a way to do it with a URL hack by adding &save=1 to the button if you have disable some CSRF protection in your org. It is better to use the AJAX toolkit as sfdc_ninja answered. See this help article: http://help.salesforce.com/apex/HTViewSolution?id=000176169&language=en_US


Create a button with Behavior of 'Execute Javascript', and content source of 'OnClick Javascript'


  var myTask = new sforce.SObject("Task");
  myTask.WhoId = "{!Lead.Id}";
  myTask.Subject = "Walk-In-Visit ";
  • That worked beautifully. Thanks a ton. I just added the last bit - myTask.Status = "Completed"; - to complete the task but I appreciate the response. And for the quick AJAX tutorial. – user6966 Feb 22 '14 at 18:13
  • No worries. Glad to help :) – Chris Duncombe Feb 22 '14 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.