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>,<query_value>,<page>, <per_page>, <connection>);
where,
| Parameter | Data type | Description |
| <response> | KEY-VALUE | Holds the response returned by Zoho CRM on successful task execution or error details on task failure. |
| <relation_name> | TEXT | Specifies the API name of the submodule or the related list. |
| <parent_module_name> | TEXT | Specifies 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. |
| <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. |
<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. |
| <connection> | TEXT | Represents the link name of the connection which is connected to your Zoho CRM account. Note:
|
Note:
In integration tasks, the parameters must be in the defined order as given in the syntax, for the Deluge task to be executed. If you choose to use an optional parameter, ensure that all preceding parameters in the syntax are explicitly specified. If a preceding optional parameter is not required, a null value can be assigned instead, to maintain the defined syntax order.
For example, in the below syntax, options_map and connection are optional parameters:
<variable> = zoho.crm.v8.task (<module_name>, <record_details>, <options_map>, <connection>);
If you want to use the connection parameter, module_name, record_details and options_map must be specified in the
exact order as the syntax. You can assign an empty map to the options_map parameter if it is not required.
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,query_data,1,2,"crm");
where,
response"Contacts""Accounts"4770XXXXXXXXXXquery_data"fields"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.