Choose where you’d like to start

Get related records from Zoho Bookings

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>);
ParamsData typeDescription

<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:

  • Services
  • Staffs
  • Resources

<parent_module> 

TEXT

The name of the parent module to which the submodule is related.

The applicable modules are:

  • Services
  • Workspaces

<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:

  • service URL:
    https://bookings.zoho.com/#/app/manage-business/services/<record_id>/service-info
  • workspace URL:
    https://bookings.zoho.com/#/app/manage-business/workspace/<record_id>/basic-info
    (or)
    You can also use zoho.bookings.getWorkspaces task to fetch the ID of a record in workspace module. Click here to learn more about it.
  • You can also use the invoke URL task to fetch records from the required module. Visit Zoho Bookings API help and navigate to the details of the required module. The response will contain the IDs of all the records in the module, which can be extracted as illustrated in this sample snippet

<connection>

TEXT

The name of the connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • Add relevant scopes while creating the connection.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

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
The variable which holds the response in KEY-VALUE format.
"staffs"
The TEXT that represents the submodule from which the records need to be fetched.
"service"
The TEXT that represents the parent module.
3883XXXXXXXXXXX7032
The NUMBER that represents the ID of the record to which the submodule is related.
"bookings_oauth_connection"
The TEXT that represents the name of the 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"
     }
     }

Related Links

Get Started Now

Execute