You need to sign in to do that
Don't have an account?

Count contact records within a listView
Hi Guys,
I'm using salesforce api to get all contacts from a list view.
I can also use limit & offset aswell but my problem is I could not found a way to count all contacts within a list view.
I use the following endpoint services/data/v36.0/sobjects/Contact/listviews/
Is there any way to count the result so I can pass the limit & offset for next query ?
Thanks
Sohel Amin
I'm using salesforce api to get all contacts from a list view.
I can also use limit & offset aswell but my problem is I could not found a way to count all contacts within a list view.
I use the following endpoint services/data/v36.0/sobjects/Contact/listviews/
Is there any way to count the result so I can pass the limit & offset for next query ?
Thanks
Sohel Amin
you can use aggregrate functions for this as below code
Please see below link to have more information
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_agg_fns.htm
Please let us know if this helps you.
Thanks and Regards
sandhya
Let me clear more, I'm trying to get all contacts from a list view I can do it but I can't count the result so I can do paging query.
https://ap2.salesforce.com/services/data/v36.0/sobjects/Contact/listviews/<LISTVIEWID>/results
If you know the SOQL for that then please let me know.
After i do some google search i found same thread answered by people.please see this you can get some idea
https://success.salesforce.com/answers?id=90630000000DJDRAA4
Please let us know if this helps you.
Thanks and Regards
sandhya
1. Get the query : Use to get the query used to filter the list. Extract the WHERE clause from this.
2. Run the query to get count of records: Create a SOQL by concatenating , 'SELECT COUNT(Id) FROM ' +<WHERE clause from Step 1>