• Dominic Sharpe
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I'm a beginner when it comes to Javascript. We have an existing custom button that creates a new task on the Contact object. Here's the existing code:

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

var myTask = new sforce.SObject("Task");
myTask.WhoId = "{!Contact.Id}";
myTask.Subject = "Follow Up";
sforce.connection.create([myTask]);
window.location.reload();

However, our requirements have changed. We now need the button to work ONLY when all tasks on the Contact are CLOSED. And instead of creating the task right away, the button should take the user to the task edit page to be able to enter comments. The user will save the task manually.

How do I use javascript to make sure that all tasks are closed?
How do I redirect the user to the task edit page?

Any tips and/or sample code I could work with would be of great help
Hi All,

We have a new requirement to prefill name field with Contact related to the object from where the new task is being created. I want this to be done globally.  Can this be achieved?

I have done URL hacking for two custom objects previously but now my users want this to happen every time they create a new task.

Any Ideas?
  • July 30, 2014
  • Like
  • 0