Another Salesforce blog!!!

Salesforce, Apex

Apex from Custom button or Javascript : Ajax toolkit


global class myClass {
	webService static Id makeContact (String lastName, Account a) {
		Contact c = new Contact(LastName = lastName, AccountId = a.Id);
var account = sforce.sObject("Account");
var id = sforce.apex.execute("myClass" , "makeContact",
{lastName:"Smith", a:account});

To call a webService method with no parameters, use {} as the third parameter for sforce.apex.execute .

Leave a Reply

Your email address will not be published. Required fields are marked *