Showing posts with label when custom button is added on List View page. Show all posts
Showing posts with label when custom button is added on List View page. Show all posts

Monday, January 27, 2014

How to get selected records ID from List View using Javascript / Ajax Toolkit, when custom button is added on List View page

How to get selected records ID from List View using Javascript / Ajax Toolkit, when custom button is added on List View page

Create a new Button on Lead of type List Button. Add the button on Lead List View Layout and write below Javascript code:
{!RequireScript("/js/functions.js")}

var recordsSelected = {!GetRecordIds($ObjectType.Lead)}
for(var i=0; i < recordsSelected .length ; i++) {
     alert('Selected ID '+recordsSelected[i]);

}