[SalesForce] How to query ListView records that were created by users

When logging in as a user I can see that they have ListView's that I can't find programatically (I'm a System Administrator). Using the Id of the ListView in the URL when logging in as that user, I looked for the list view in the following ways

QUERIES:

SELECT CreatedBy.Name,CreatedDate,DeveloperName,Id,LastViewedDate,Name FROM ListView

SELECT CreatedBy.Name,CreatedDate,DeveloperName,Id,LastViewedDate,Name FROM ListView USING SCOPE EVERYTHING

(The ListView returned records, but only public list views)

SELECT Id FROM UserListView

SLECT Id FROM UserListView USING SCOPE EVERYTHING

(The UserListView qeuries returned no records)

REST EXPLORER:

/services/data/v45.0/sobjects/ListView/00B1Y000007ErH0 where 00B1Y000007ErH0 is the Id I found while logging in as the user.

(I got a resource not found error)

BULK API:

I exported the entire ListView table via the bulk API but got the same results as the ListView queries above. The UserListView was not available via the bulk API.


I looked through the questions and answers of the following posts and did not find my answer.


Has anyone had any success programatically accessing ListView's that users have created? I need to do some auditing on what kind of views they are creating.

EDIT:

In the metadata documentation for list views I noticed it says

List views with the Visible only to me Restrict Visibility option are not accessible in Metadata API. Each of these list views is associated with a particular user.
I wonder if that applies to more than just the metadata api and is completely inaccessible without logging in as each user.

Best Answer

As another user, there is no way to query any ListView record where the person creating it selected "Visible only to me". As you already found, the Metadata API makes this clear, and there are no exceptions in other APIs either.

Related Topic