+ Start a Discussion
prady-cmprady-cm 

How do we show a list of reports accesible by the current logged in user in a Vf page

I am trying to show a group of reports that are accessible by the logged in user in a VF page. Is there are any object where this info is stored ?

Any pointers would be of great help.

Thanks

ReidCReidC

I suppose it depends on how the reports are shared.

The challenge is that access to reports is controlled by access to the folder.

Folders have access type Hidden, Public or Shared.  

Public is easy enough.  Everyone has access.

Shared is the hard one -- as the docs note, 

  • Shared—Folder is accessible only by a User in a particular Group or UserRole. The API doesn’t allow you to view, insert, or update which group or Role the Folder is shared with.

Your basic list SOQL would look something like:

 

Select Id, Name From Report Where OwnerId in (Select Id From Folder Where type = 'Report' AND AccessType='Public')

 

For unfiled public reports, set the OwnerId to your OrgId.

 

HTH

Thx for the fun quesiton!