• pshemek
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi,

 

I'm trying a fairly simple call of an Apex method from a custom detail button in Account. The argument I need to send is the Account object itself. I don't know how to reference it. I tried the example from the Apex development guide, which is:

 

{!requireScript("/soap/ajax/15.0/connection.js")}
{!requireScript("/soap/ajax/15.0/apex.js")}
var acct = sforce.sObject("Account"); 
var id = sforce.apex.execute("myClass","makeContact",
                             {lastName:"Smith",
                              a:account});

 

Even if I comment out the call to apex, the line

var acct = sforce.sObject ("Account");

Gives me an error:  Object doesn't support this property or method.

 

I also tried through a global variable

var acct = $ObjectType.Account;

But that doesn't work either.

 

What am I missing? How do I reference the Account object in a button?

 

Thanks very much.