Get related records from Zoho Bookings
Table of Contents
Overview
This task is used to fetch records from a submodule related to a specified record in a parent module.
This task is based on Zoho Bookings API.
Syntax
<response> = zoho.bookings.getRelatedRecords(<module>, <parent_module>, <record_id>, <connection>);
Params | Data type | Description |
<response> | KEY-VALUE | Variable which will hold the returned response. |
<module> | TEXT | The name of the submodule from which the records will be fetched. The applicable modules are:
|
<parent_module> | TEXT | The name of the parent module to which the submodule is related. The applicable modules are:
|
<record_id> | NUMBER | The ID of the record in the parent module whose submodule records will be fetched. Note: You can get the ID of the record from the URL. The URL is in the following format:
|
<connection> | TEXT | The name of the connection. Note:
|
Example
The following example fetches all the records in the module - staffs that are related to the record of ID - 3883XXXXXXXXXXX7032 in the parent module - services:
response =zoho.bookings.getRelatedRecords("staffs", "services", 3883XXXXXXXXXXX7032, "bookings_oauth_connection");
where:
response
"staffs"
"service"
3883XXXXXXXXXXX7032
"bookings_oauth_connection"
Response Format
Success Response
The success response will be returned in the following format:
{
"response": {
"returnvalue": {
"data": [
{
"name": "Hailee",
"id": "3883XXXXXXXXXXX7008",
"email": "hailee@zylker.com"
},
{
"name": "Shawn",
"id": "3883XXXXXXXXXXX7016",
"email": "shawn@zylker.com"
}
]
},
"status": "success"
}
}
To fetch the ID of the records, use the following script:
for each var in <response_variable> { list_var = var.get("returnvalue").get("data"); for each var1 in list_var { info var1.get("id"); } }
Failure Response
The failure response for incorrect or non-existent record ID will be returned in the following format:
{
"response": {
"returnvalue": {
"mesage": "There is no active staff for the criteria",
"status": "failure"
},
"status": "success"
}
}