+ Start a Discussion
Baktash H.Baktash H. 

Get List Views in Apex Code

Hello,

 

i wanted to know if there is a way to get the IDs of listviews of an Object in Apex Code.

 

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Construct a StandardSetController for the type of SObject (using a QueryLocator) you'd like to retrieve the list views for, then call getListViewOptions against the StandardSetController.

All Answers

sfdcfoxsfdcfox

Construct a StandardSetController for the type of SObject (using a QueryLocator) you'd like to retrieve the list views for, then call getListViewOptions against the StandardSetController.

This was selected as the best answer
rvattamrvattam

hi  how to get the related records from the particular  list view in apex 

 

currently i am doing like this 

selectedView- contains the filterId of the list view

 

 

leadSet.setFilterId(selectedView);
leadList = leadSet.getRecords();
system.debug('leadList::::::::::'+leadList);

 

but i am getting Null in the above debug

Abhishek Prasad 8Abhishek Prasad 8
Use this link:
http://www.jitendrazaa.com/blog/salesforce/listview-filter-in-apex-with-paging-and-navigation/