So, you might know already how to get a button on a page somewhere and perform actions with a function when pressed, but how about a button that only works with the records you selected in the list view?
The button selected is a custom button in the modules section of in this example, Accounts. Create the button and choose "List View - Mass Action Menu".
Choose to create a new custom function and set the parameters to requestParams with value to Request -> Parameters. This is done by entering the # sign and then change from Accounts to Request in the dropdown box that appears.
Now you have a custom function that will pass info from your button and do something with it. Here is a code example of that:
idList = requestParams.get("ids").toList(",");
for each id in idList
{
count += 1;
}
return "You selected " + count + " records from " + requestParams.get("moduleDisplayName");
Now when you press the button you will see the popup appear with the return value of that function.
For those who will say "There is an error when there are no ids in the requestParam", don't worry, since the button will not appear when nothing is selected, the code works just fine and we don't need to declare count.