function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AlexPHPAlexPHP 

Querying for a user's "Recent Items" list

Is there a way to query for a particular user's "Recent Items" list?

 

That is, I want to be able to fetch a list of the last several records of a particular object that a particular user has viewed.

 

Thanks

NBlasgenNBlasgen
I had previously asked this as a way to update the Recent Items list, but in anycase the answer seems to be that there is no access to recent items via Apex or API.  But maybe someone else will know better.
ciccic
If you just want one object you can query the last modifed by and date to get a list of recent objects by current user.  You could try "touching" an object to get it into the least recently used list.  But yes, no access to it directly.
NBlasgenNBlasgen

cic,

 

Sadly that only gives you the most recently modified item.  Recent items is a list of recently viewed items.  Would be nice to have access to that data.  Oh well.

AlexPHPAlexPHP

Thanks for the information guys.

 

It looks like all we can do at this point is to promote the idea to have the capability to access the recent items list:

http://sites.force.com/ideaexchange/ideaView?c=09a30000000D9xt&id=08730000000BrkWAAS

mtbclimbermtbclimber
This was delivered a while ago. The entity is RecentlyViewed (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/object_reference/sforce_api_objects_recentlyviewed.htm) which is queryable.
Prashant Pandey07Prashant Pandey07
SELECT Id, Name
FROM RecentlyViewed
WHERE LastViewedDate !=null
ORDER BY LastViewedDate DESC