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 件のコメント:
コメントを投稿