Is it possible for me to use the FOR VIEW clause in SOQL for another user instead of the CurrentUser. For example I want to see how many records on the Case object a certain user has viewed in one day.


Well this is not possible out of box. SFDC does not allow you to track record views by default the way you described above "I want to see how many records on the Case object a certain user has viewed in one day".

So, you will have to use apex & VF. Here are steps for one of such simple implementation.

  1. Create a object Case_views__c to track record view with 2 fields case_ID & user_ID
  2. Create a vf page to show case details using tag
  3. In controller insert record in Case_views__c
  4. Override case page detail view with this page VF page

Now every time user view case record SFDC will make entry in Case_views__c object.

You can then create a report to group by user and count the cases that they views in particulate time period

  • What about query access? Or Report views/exports? This is a very small piece of the puzzle, I think. – Adrian Larson Oct 26 '16 at 23:18
  • That is the whole point of FOR VIEW. To track which records have been viewed – Bryan_Anderson_SL Oct 26 '16 at 23:24
  • @Bryan_Anderson_SL for view tracks the information in RecentlyViewed table, however, the table doesn't have the information on who viewed the data – Lance Shi Oct 26 '16 at 23:37
  • 1
    @Bryan_Anderson_SL FOR VIEW only tracks ~200 records per object per user. If you want something more comprehensive, you need Event Monitoring. This solution works well for UI views, which should be a reasonable approximation for average users. – sfdcfox Oct 26 '16 at 23:52
  • @sfdcfox Record view is not tracked in event monitoring. – AtulRajguru9 Oct 27 '16 at 0:03

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.