Get Records from Zoho CRM V8
Table of Contents
Note:
- Each time the zoho.crm.v8.getRecords integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.crm.v8.getRecords integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
Overview
This task is used to fetch records from the specified Zoho CRM module.
Syntax
<variable> = zoho.crm.v8.getRecords(<module_name>, <page>, <per_page>, <options_map>, <connection>);
where,
| Parameter | Data type | Description |
| <variable> | KEY-VALUE | Holds the response returned by Zoho CRM. It represents the fetched record as a KEY-VALUE map in JSON format, where each key is a Zoho CRM field API name and each value is the corresponding field value. |
| <module_name> | TEXT | Specifies the API name of the Zoho CRM module from where the records will be fetched. |
<page> (optional) | NUMBER | Indicates the page index from where the records must be fetched. Default value: 1 |
<per_page> (optional) | NUMBER | Specifies the number of records that need to be fetched per page. Default value: 200 Note: The <page> parameter must be specified in order to use this parameter. |
<query_value>
| KEY-VALUE | Used to hold all the other parameters specified in the Zoho CRM API. Only the <field> key and its corresponding value are mandatory in this collection. All other keys are optional. Note:
|
| <connection> | TEXT | Represents the link name of the connection which is connected to your Zoho CRM account. Note:
|
Examples
1. Fetch records from Contacts module
The following script fetches the first 10 records of specified fields from the Zoho CRM Contacts module and sorts the fetched records in ascending order based on the field - First_Name.
query_data = Collection(); query_data.insert("sort_order":"asc");
query_data.insert("sort_by":"Created_Time"); query_data.insert("fields":"First_Name,Last_Name,Mobile"); response = zoho.crm.v8.getRecords("Contacts", 1, 10, query_data, "crm_connection");
where
response"Contacts"110query_data"sort_order" "sort_by"
"fields""crm_connection" 2. Fetch data from a Custom Module
The following script fetches the records of specified fields in query data, from Zoho CRM custom module - Hotels.
query_data = Collection(); query_data.insert("fields":"Hotel_Name,Address,Phone"); response = zoho.crm.v8.getRecords("Hotels", 1, 200, query_data, "crm_connection");
where:
response "Hotels" Response Format
Success Response
The success response returned when a lead is fetched from Leads module is of the following format. The records of fields mentioned in the query value parameter are only returned.
{
"Owner":{
"name":"Ben",
"id":"29383XXXXXXXXXXXXXX"
},
"Company":"Zylker",
"Email":"bruce.wills@zylker.com",
"First_Name":null,
"Full_Name":"Wills",
"Phone":"+1 678 XXX XXXX",
}
To get the list of record IDs from the response, execute the following snippet:
<list_variable> = list(); <variable> = <response_variable>.toJsonList(); for each <loop_variable> in <variable> { <variable1> = <loop_variable>.getJson("id"); <list_variable>.add(variable1); info <list_variable>; }