Get Related Records from Zoho CRM V8

Note:

  • Each time the zoho.crm.v8.getRelatedRecords 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.getRelatedRecords 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 a submodule(related list) related with a specific  record in a parent module in Zoho CRM. For instance, Notes attached to a particular Lead or Contacts linked to a particular account can be fetched using the ID of 
the parent module record.

Syntax

<response> = zoho.crm.v8.getRelatedRecords(<relation_name>, <parent_module_name>, <record_id>,
<page>, <per_page>, <query_value>, <connection>);

where,

ParameterData typeDescription
<response> KEY-VALUEHolds the response returned by Zoho CRM on successful task execution or 
error details on task failure.
<relation_name>TEXTSpecifies the API name of the submodule or the related list.
<parent_module_name> TEXTSpecifies the API name of the module to which the submodule belongs. For 
example, the “Notes” submodule belongs to the “Leads” parent module.
<record_id> NUMBER

Specifies the ID of the parent module record.

Learn how to retrieve the unique record ID from the response returned by Zoho CRM after creating, searching, or fetching a record.

<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

Holds 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.

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:

Example: Fetch Notes from Leads module

The following script fetches specified field records from Contacts module associated to the Account with ID - 4770XXXXXXXXXXX in Zoho CRM.

query_data = Collection();
query_data.insert("fields":"First_Name,id,Email,Last_Name");
response = zoho.crm.v8.getRelatedRecords("Contacts","Accounts",4770XXXXXXXXXXX,1,2,query_data,"crm");

where,

response
is the variable which holds the data returned by Zoho CRM.
"Contacts"
is the TEXT that represents the API name of the submodule, from where records need to be fetched.
"Accounts"
is the TEXT that represents the parent module to which the submodule belongs. In this example, “Contacts” is the submodule which belongs to the “Accounts” module.
4770XXXXXXXXXX
is the NUMBER that represents the parent module record (Accounts) ID.
query_data
is the KEY-VALUE variable that holds the query parameters.
"fields"
is the mandatory system parameter key required to filter fetched records.

Response Format

The following is a sample response returned when related records are fetched:

{
   "First_Name": "Harry",
   "Email": "harrybales@zylker.com",
   "Last_Name": "Bales",
   "id": "23033XXXXXXXXXXXXXX"
}

Note: Refer to Zoho CRM API document - Related Records Data for possible error responses.