Monday, June 20, 2011

Invoking web services method using custom Button



Create a custom button on object :
Select Execute JavaScript

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
 var result = sforce.apex.execute("SendByButton", "SendMail",{});

Apex webservice class :
================

global class SendByButton
{
  WebService static Void SendMail()
  {
     // Code here

  }
}


Note : If method having list of parameters then put the number of parameters  inside SendMail,{}

No comments:

Post a Comment