I created an activity list button to select multiple records from a list view and process in a visualforce page/apex controller. I used GETRECORDIDS($ObjectType.Event) to get Ids of selected Event records. BUT it returned ids of tasks too. Then I replaced $ObjectType.Event by $ObjectType.Task the returned result was same. I then replaced it by $ObjectType.Contact still the returned result was same.

My question is if selected ids are returned irrespective of the $ObjectType.object then why it is there? Am i missing something?

Here is the code on the Button:

var ids = {!GETRECORDIDS($ObjectType.Event)}; 
if (ids.length) { 
window.location = '/apex/mypage?ids=' + ids.join(','); 

} else { 
alert('Select one or more Records'); 
  • What does the rest of the code on your button look like? Commented Nov 30, 2014 at 4:35
  • @MarkMasterson I have updated the question and added the code of the Button. Thanks
    – abdn
    Commented Nov 30, 2014 at 12:08

1 Answer 1


The list button you have created on Activity(combination of tast and event in salesforce) object, so it will always return the ids of activity(Event+Task) regardless of what type you are using with $ObjectType.

So the conclusion is you can use only type for which your list button is created.

example if you create a list button on contact then in the javascript, you can use GETRECORDIDS($ObjectType.Contact) or even pass any other object name or any value like GETRECORDIDS('XXX') still it will return the contact ids only. function GETRECORDIDS requires one parameter so you need to pass the value for the first parameter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .