I am trying to get a sample of which records are being viewed. When I run the following SOQL query…
SELECT Id, FirstName, LastName, LastViewedDate FROM Contact WHERE LastViewedDate = TODAY
…It returns Contact records viewed by ONLY me, not other users.
Can anyone confirm this behavior? How do I see Contact records viewed by ALL users in my instance?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The LastViewedDate is per user. You can use it to display a most recently viewed list to a user, and this affects lookup dialogs and search results. If you haven’t viewed the record, LastViewedDate is null for you. This is not an administrative field to see when records were viewed, but a developer feature to provide user interfaces that can show the user record they’ve recently worked with. The LastViewedDate will be different for two different users on the same record in most cases (e.g. unless they coincidentally view the exact same record at the exact same time).
See the RecentlyViewed object for more details.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0