For this tutorial in video form, click here

In the first edition of Zoho CRM API, there used to be a hack allowing for search records with multiple criteria . This was done by doing zoho.crm.getRecords with the name of a custom view.

In this example, the custom view was called test leads.

You actually had to put the name of the module at the start.

API v2

In API v2, this doesn’t work anymore, but there’s an even better way of doing it. Notice how there’s an ID after custom view in this URL (803228000… in the screenshot below):

That’s actually the custom view ID. Let’s try creating a custom function to retrieve data from this custom view. We’ll head over to Setup > Developer Space > Functions.

We’ll then click “Create New Function”.

Make it a Standalone function, then click next.

Enter the following code:

custom_view_leads = zoho.crm.getRecords("Leads", 1, 200, { "cvid": 803228800012412412412412 });
return custom_view_leads; 

Let’s break that down. The first parameter is the API name for the module (“Leads”). The second parameter is the page number (you could use a for loop to iterate over multiple pages of data). Next we have the records per page (200). Finally we have a map where we can pass special properties like the cvid (custom view ID) and the sort order. Upon saving the script, we can see it’s successful and we get all the leads in that custom view:


All of this is in the documentation for the v2 API. Have a look at the other parameters you can pass. I find “converted”, “sort_by” and “sort_order” to be quite useful.

For this tutorial in video form, click here