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
Rahul KishoreRahul Kishore 

Query Contact View instead of Contact table/object

Hello, 

I have a particular question where I can't seem to find any tangible examples on. 

I am writing a query like this but this is querying directly from the Contact table/object: 
 
string query = "?q=SELECT Id, Name, firstname , lastname, title, department , birthdate, phone , fax,  email, accountId, Account.Name, MailingStreet, MailingCity ,MailingState, MailingPostalCode, MailingCountry, OtherStreet,OtherCity,OtherState,OtherPostalCode,OtherCountry  from Contact";

What I want to do is query from the following: 

User-added image

I can't seem to find a way to query any of the items that are presented in the list. 

Is there a way if I can query these lists/tables/objects? I am unsure of what to call them at this point. 

If there is a way to query the object any code example would help me. 

Thank you. 
AnjunaAnjuna
Hi Rahul,

You can query from ListView as follows. Specify the sobject type to get the list view elements corresponding to each sobject.
select id,name from listview where SobjectType='Contact'
For more details refer https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_listview.htm