Play Games

Search This Blog

Monday, November 18, 2013

How to get related list records count using on click javascript?

How to get related list records count using on click javascript?

For example contact is a related list in account detail page.A custom button is there in account detail page.If I click it,I want to know how many contacts are associated with that account.
The sample code is given below.


{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var num=
    sforce.connection.query('SELECT Id,name FROM contact WHERE accountid = \'{!Account.Id}\'');
var d=num.getInt('size');
alert(d);

window.location.reload();

1 comment: