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
Firas Taamallah 12Firas Taamallah 12 

How to retrieve records from list view ? Soql ?

Hi , 

I want to retrieve records from my custom list view in Contact object 
Can anyone help me ? 

Select id, Name from Contact where ... 
Abhishek BansalAbhishek Bansal
Hi Firas,

The custom list views are created by using some of the filters. You can use the same filters in your query and than you will get the same records as shown in that list view.
For Eg: Lets suppose you have created a list view where you want to see only contacts that you own, so for this list view you can use the below SOQL:
Select Id, Name from Contact where Owner.Name = 'Your_Name'

So like this you can use the filters of the list view to query same records from the database. Let me know if you need any further help on this.

Thanks,
Abhishek Bansal.
Firas Taamallah 12Firas Taamallah 12
Hi Abhishek ,

Sorry but this is not the best answer , i'm deveoping new button " Export " it will export the data based on list view's records

Example:
  • List view  A : has  4 records so when click on Export it will export 4 records
  • List view  : has  10 records so when click on Export it will export 10 records

 
vishal-negandhivishal-negandhi

Hi Firas, 

This should give you some leads - https://developer.salesforce.com/forums/?id=9062I000000XmcgQAC

Hope it helps.

 

Best,

Vishal