2011年1月27日木曜日

sforce.apex.execute

Apex class→
global class executeAnonymous {
webService static integer getContactCount(String accountId) {
return [select count() from Contact where AccountId =:accountId];
}
}
---------------
Custom ButtonのJavaScript→
{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/19.0/apex.js")};
alert(sforce.apex.execute("executeAnonymous","getContactCount",{accountId:'{!Account.Id}'}));

0 件のコメント:

コメントを投稿