'Recent Items' pane shows recently viewed records for the selected tab. The list is derived from your recent items and includes records owned by you and other users.

Is there any way to get this in apex?
|
'Recent Items' pane shows recently viewed records for the selected tab. The list is derived from your recent items and includes records owned by you and other users.
Is there any way to get this in apex? |
|||||
|
|
It isn't a native Apex solution, but you can use the REST API to pull the recent items. Using the Workbench try: https://workbench.developerforce.com/restExplorer.php?url=/services/data/v26.0/recent&autoExec=1
Here is the Code (how to call it from Apex and it works) -
Here is output from Debug log
|
|||||||||||||
|
|
There is a new object available in Summer '13 called RecentlyViewed that you can use in SOQL to get a user's recently viewed records. |
|||
|
|
|
If you really need it in Apex (or are after generic solution) then Daniel's idea looks awesome! I've been thinking about this problem few weeks ago but came up with some really crazy answers (screenscraping of a tab with recent items; analysis of URL you get when you click a lookup window and by default it shows recently viewed items...). Messy. There's one Visualforce possibility I came up with so I'm going to left it here, maybe will be of use for anybody? You could experiment with |
|||
|
|