Fetch related records by ID

Get related record By ID from Zoho Desk

Overview

This task is used to fetch a related record using its ID, from a parent record in Zoho Desk.

Syntax

<variable>=zoho.desk.getRelatedRecordById(<orgID>, <sub_module>, <sub_recordID>, <parent_module>, <parent_recordID>, <connection>);

where,

ParameterData typeDescription

<variable>

KEY-VALUE

variable to hold the response returned by Zoho Desk. It represents the values of the record fetched from the required submodule.

<orgID>

NUMBER

specifies the organization ID of the account from which the record will be fetched. This can be found in Zoho Desk Settings > Developer Space > API.  

<sub_module> 

TEXT

specifies the name of the submodule from which the record will be fetched. 

This task allows you to fetch:

  • a thread based on a ticket

  • a timeEntry based on a ticket

  • a timeEntry based on a task

  • a timeEntry based on an agent

<sub_recordID>

NUMBER

specifies the ID of the record that will be fetched.

<parent_module>

TEXT

specifies the name of the parent module whose related record will be fetched.

<parent_recordID>

NUMBER

specifies the ID of the parent record.

Learn how to fetch the record ID after creatingsearching or fetching records.

<connection>

(optional)*

TEXT

specifies the name of the connection.

The scopes which need to be selected are:   
- Desk.basic.READ 
- Desk.tasks.READ 
- Desk.tickets.READ 
- Desk.settings.READ 

*Note: This is a mandatory param when used in Zoho Creator.

Example

The following script fetches the timeEntry of record ID - 168XXXXXXXXXXXX065 which is associated with the task of record ID - 168XXXXXXXXXXXX043.

response = zoho.desk.getRelatedRecordById(641XXXXXX, "timeEntry", 168XXXXXXXXXXXX065, "tasks", 168XXXXXXXXXXXX043, "desk_connection");

where,

response
variable which will hold the response returned by Zoho Desk. It represents the value of the record fetched.
641XXXXXX
is the NUMBER that represents the organization ID.
"timeEntry"
is the TEXT that represents the name of the module from which the record needs to be fetched
168XXXXXXXXXXXX065
is the NUMBER that represents the ID of the related record that needs to be fetched
"tasks"
is the TEXT that represents the name of the parent module
168XXXXXXXXXXXX043
is the NUMBER that represents the ID of the record in the parent module whose related record needs to be fetched
"desk_connection"
is the TEXT that represents the name of the connection.

Sample Response

Success Response

  • The success response returned is of the following format. It represents the values of the record in submodule that corresponds to the specified ID.

      {
      "customFields": {
      "bugTimeLogID": null,
      "Date and Time Completed": null
      },
      "ownerId": "168XXXXXXXXXXXX005",
      "requestChargeType": "Customer Service",
      "executedTime": "2019-01-25T06:28:39.000Z",
      "hoursSpent": "3",
      "minutesSpent": "23",
      "secondsSpent": "21",
      "agentCostPerHour": "3.0",
      "additionalCost": "10.0",
      "totalCost": "20.17",
      "description": "Time Entry description",
      "requestId": null,
      "createdTime": "2019-01-24T22:28:23.000Z",
      "createdBy": "168XXXXXXXXXXXX005",
      "departmentId": "168XXXXXXXXXXXX907",
      "parent": {
      "associatedTicketId": "400XXXXXX017",
      "id": "168XXXXXXXXXXXX043",
      "type": "TASKS"
      },
      "invoiceId": "400XXXXXXXXXXX212",
      "id": "168XXXXXXXXXXXX065",
      "taskId": "168XXXXXXXXXXXX043"
       }

Failure Response

  • The failure response returned for incorrect or non-existent organization ID is of the following format.

       {
       "errorCode":"UNPROCESSABLE_ENTITY",
       "message":"The value passed for the 'orgId' parameter is invalid."
       }
  • The failure response returned for an incorrect or non-existent record ID is of the following format.

       {
       "errorCode":"URL_NOT_FOUND",
       "message":"The URL you requested could not be found."
       }
  • The failure response returned for an incorrect or non-existent parent ID is of the following format.

      {
      "errorCode":"INTERNAL_SERVER_ERROR",
      "message":"An internal server error occurred while performing this operation."
       }

Related Links

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com