• sunny_4017
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I know you can create a custom button and create a task on click using Javascript. can you apply the same thing to visualforce pages? The button code looks like this:

{!REQUIRESCRIPT("/soap/ajax/17.0/connection.js" )}
var t1= new sforce.SObject("Task" );
      t1.OwnerId = "##############3";
      t1.Subject = "This is my subject";
      t1.Status = "Not Started";
      t1.Priority = "Normal";
      t1.whatId = "#############";
      result = sforce.connection.create([t1]);

So would the VF page code look like this?

<apex:page >
<script language="Javasript">

var t1= new sforce.SObject("Task" );
      t1.OwnerId = "##############3";
      t1.Subject = "This is my subject";
      t1.Status = "Not Started";
      t1.Priority = "Normal";
      t1.whatId = "#############";
      result = sforce.connection.create([t1]);
</script>
</apex:page>

This doesn't work though. Any thoughts?

  • July 29, 2013
  • Like
  • 0