2 | webService static Id makeContact (String lastName, Account a) { |
3 | Contact c = new Contact(LastName = lastName, AccountId = a.Id); |
we can execute above method from javascript like :
1 | {!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")} |
2 | {!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")} |
3 | var account = sforce.sObject("Account"); |
4 | var id = sforce.apex.execute("myClass" , "makeContact", |
5 | {lastName:"Smith", a:account}); |
To call a webService method with no parameters, use {} as the third parameter for sforce.apex.execute .
Also, you can use the following line to display a popup window with debugging information:
sforce.debug.trace=true;
No comments:
Post a Comment