Get Listview Records | Listview filters and Query in Apex

Sometimes it is very needed to get Listview records. But what if you get all Listview fields and filters. With this method you can get listview fields, filter, sorting order and even query too.

This method uses the REST API to make a callout and fetch the listview data. To get all these listview data you need to pass listview Id and sObject name to it. Listview Id can be easily fetched by querying on Listview object. You can use the below query to get Listview Id.

Here you can pass your listview name in the WHERE condition of the query to get your specific listview Id. You also need to pass your session Id into it as it is s REST API callout.

Here, to get another data you need to iterate tokenResponse variable. This variable will provide you the below data.

get listview records query filters and fields

So this way you can easily fetch Listview records, fields, filters, and query. Also, the sort filters.

If you want to get records directly, you can use the below endpoint in this method. But fetching records using this have some limits. You can check out more information here.


Also Check:

For any queries or suggestions, comment below.

Cheers … Happy Coding … 🙂

Notify of
Inline Feedbacks
View all comments
Mohammad Imran

In the Get Listview Records | Listview filters and Query in Apex, how can I use it on visual force page and get the related items from this list view?


getting Unauthorised error 401

Last edited 2 months ago by SHUBHAM