Get Records from Zoho CRM V8

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,

ParameterData typeDescription
<variable>KEY-VALUEHolds 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>TEXTSpecifies 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:

  • The keys and values of this param should be provided according to the Zoho CRM API.
  • The <page> and <per_page> params must be specified to be able to specify this param.
<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
is the variable which holds the records fetched from Zoho CRM's Contacts module.
"Contacts"
is the the API name of the Zoho CRM module from which the records will be fetched.
1
is the NUMBER that represents the page index of Zoho CRM module API data.
10
is the NUMBER that represents the number of records that will be fetched per page.
query_data
is the KEY-VALUE variable that holds the query parameters.
"sort_order"
"sort_by"
are the system parameter keys specified in the Zoho CRM API that are required to sort the fetched records.
"fields"
is the mandatory system parameter key required to filter fetched records.
"crm_connection"  
is the TEXT that represents the link name of the 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   
is the variable which holds the records fetched from Zoho CRM's Custom Module.
"Hotels"  
is the TEXT that represents the API name of the Zoho CRM's custom module from which the records are to be fetched.

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>;
}