Another Salesforce blog!!!

Salesforce, Apex

APEX JAVASCRIPT

Apex from Custom button or Javascript : Ajax toolkit

Controller: global class myClass { webService static Id makeContact (String lastName, Account a) { Contact c = new Contact(LastName = lastName, AccountId = a.Id); return c.id; } } {!REQUIRESCRIPT(“/soap/ajax/33.0/connection.js”)} {!REQUIRESCRIPT(“/soap/ajax/33.0/apex.js”)} 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 […]