function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VarunCVarunC 

Is there a way for describing a List View and determining columns within APEX (without metadata service api)?

I've been reviewing the very promising APEX Metadata Namespace in Summer '17 (API v40.0) - Release Notes (Preview)

But I'm unable to find any reference for retrieving ListViews of any Object. I'm interested in reading Columns & Filter settings for List Views. The information is available in Metadata Webservice API, but not in APEX Metadata Namespace (at least I'm unable to find any reference).

If anyone with good knowledge of Metadata api, can point me in the direction of how to get the List View Describe:
  • Without using Metadata Webservice API
  • Without the need for adding External Endpoint in Remote Setting for same org
  • Without REST API

Well I'm kinda only left with 1 option of accessing via APEX, natively, because:
  • I do not want to add Remote Site setting in a managed package
  • I want to support both Classic and Lightning Environment (along with Lightning Components) and REST API is inaccessible in Lightning Components, like we can do in VF pages, and using REST API in APEX class to describe ListViews would require me to configure a Remote Endpoint in Remote Settings, which I do not want in my design.

Any suggestions, please let me know AND/OR if SFDC is watching this, then a humble request, why not include ListViews in APEX Metadata Namespace as well :-)
NagendraNagendra (Salesforce Developers) 
Hi Varun,

The short answer to this is the current version of Metadata namespace supports only custom metadata types and layouts.

It does not support objects and hence no support for list view. You will still need to use metadata API to do this or using a JavaScript library like JSforce that provides access to APIs like REST.

Hope this helps.

Please mark this as solved if it's resolved so that others can be benefitted if they are facing the same issue.

Regards,
Nagendra.