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
Ankit Singh 6Ankit Singh 6 

Integrate views to a webapp using c#

Hi

I want to integrate Views to my webapp ie I want fetch all view lists and their contacts and leads.
Currently I have integrated Objects and reports using SOAP and REST api call.
Please let me know which api call is better for integrating Views in C# and if possible some sample code.
Best Answer chosen by Ankit Singh 6
KaranrajKaranraj
Following REST API will fetch the all list view for the particual object 
/services/data/v32.0/sobjects/{ObjectName}/listviews
//Example
/services/data/v32.0/sobjects/Lead/listviews
/services/data/v32.0/sobjects/Contact/listviews

If you make call to the above REST URL it will return the all the List view in the Lead Objects.Refer this link for more details https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_listviews.htm

Thanks,
Karan
 

All Answers

KaranrajKaranraj
Ankit - You can use ListView API to access the salesforce list view from your external application,it is supported for both standard and custom object. Following REST service /services/data/v32.0/sobjects/Account/listviews/{Id}/describe will provide the the details of the list view like name, object, filter criteria and SOQL query. Then using SOQL query, you can able to get the record easily in your custom view.

Check here for more details - https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_listviews.htm
Check this blog posts - 
http://andyinthecloud.com/2014/09/20/super-listview-viewer-using-winter15-listview-api/
http://clicksandcode.blogspot.in/2014/10/export-records-from-list-view-listview.html



 
Ankit Singh 6Ankit Singh 6
Hi Karanraj

Thanks for reply.
I also wanted to know how to fetch all list views for a particular SObject(lead or contact) with their Ids and names.
Is there any api call available or we need to fire any SOQL (if SOQL then please let me know the query).
KaranrajKaranraj
Following REST API will fetch the all list view for the particual object 
/services/data/v32.0/sobjects/{ObjectName}/listviews
//Example
/services/data/v32.0/sobjects/Lead/listviews
/services/data/v32.0/sobjects/Contact/listviews

If you make call to the above REST URL it will return the all the List view in the Lead Objects.Refer this link for more details https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_listviews.htm

Thanks,
Karan
 
This was selected as the best answer