+ Start a Discussion

Need GetRecordIds functionality for Any Object

User Experience: Navigate to tab (e.g. Opportunities), select a list view, select a few records, click a list button, and be redirected to a Visualforce page.


Back end problem: The Apex controller for the Visualforce page needs access to the record ids that the user chose on the list view. In s-controls and Visualforce pages, one could use GETRECORDIDS($ObjectType.Opportunity) to get all of the opportunity ids if the user came from an opportunity list view. I would like to be able to support any object, including custom objects, so this route will not work unless there is a generic getRecordIds function. In Apex, one could specify a StandardSetController, but again, the object type needs to be predefined in the Visualforce page as the apex page's standardController.


Does anyone have any ideas about how to accomplish this without having to pass all of the record ids on the querystring for the Visualforce page?




Not sure if this would be the best design, but what you can do is that, you can store the selected record ID's in a custom obejct record say "SessionObject" and then pass the ID of this generated record as queryString parameter.

Then on the other page, you can retrieve these ID's by querying the custom obejct based on this ID!!