3

I run this query to get RecentItem data,

SELECT Id, Name FROM RecentlyViewed ORDER BY LastViewedDate DESC LIMIT 10

But I m login as same user,open SFDC Home in other tab and my customize Home in other tab. I can see that my customize RecentItem is returning different result with standard Recent Items.The left is standard RecentItem and the right is customize.For customize I am using the above query. enter image description here

Is there anyway to get exact data like standard Recent Item data?

update:

Summary: The result only achieved by using REST API.Something like below.

enter image description here

-----------------------More clarification----------------------------------------

I tried queries stated in RecentlyViewed but still it won't display same.The real case is,it can be same, it can be different.There 's no guarantee it will be displayed as standard Recent Items all the time.So I created case to SFDC regarding this.Here the reply:

"The recent items list is populated however its not an exact replica of the recent items under the Home tab.This could be due to the below reason :-

This object provides a heterogeneous list of different object types and consists of recently viewed records or records that were recently referenced (a related record was viewed). A record is considered viewed when the user sees the details associated with it, but not when the user sees it in a list with other records."

Actually this attribute already stated in the documentation.So they suggested me to use REST API, which can be referred to here.I tried it in Workbench,yes it display same as RecentItems.But note that, there is no LastViewedDate provided.

  • The answer is using REST API.It seem like my question mixed with the answer already.It's okay, just left this question open. – unidha Sep 10 '15 at 8:59
0

Try this

SELECT Id, Name
FROM RecentlyViewed 
WHERE Type IN ('Account', 'Contact', 'Opportunity', 'Lead', 'Case', 'Campaigns', 'User', 'Contract')
ORDER BY LastViewedDate DESC limit 10
  • does this confirm that I will get the same as Recent Items data?I want to know what filter that Recent Item uses in the query. – unidha Sep 8 '15 at 0:59
  • I tried run this, it still not return the same record. – unidha Sep 8 '15 at 1:08
  • Hi, try this query: SELECT Id, Name FROM RecentlyViewed WHERE LastViewedDate != NULL ORDER BY LastViewedDate DESC limit 10 The reason behind this problem is if current user have viewed other users and the LastViewDate for those records are null. Thats why there was difference in previous query. Thanks – Ajay Dubedi Sep 9 '15 at 14:14
  • appreciate your reply, i tried it already but the output still not the same.Please refer to my answer. – unidha Sep 10 '15 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.