Choose where you’d like to start

Create related record in Zoho Desk

Overview

This task is used to create a record in a sub module belonging to a record in a parent module in Zoho Desk.  

Syntax

<variable> = zoho.desk.createRelatedRecord(<orgId>, <sub_module>, <parent_module>, <record_id>, <record_value>, <connection>);

where,

ParameterData typeDescription

<variable>

KEY-VALUE

variable which will contain the response returned by Zoho Desk. It represents the values of the record created.

<orgId>

NUMBER

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

<sub_module> 

TEXT

specifies the name of the sub module.

This task allows you to create:

  • timeEntry based on a ticket

  • timeEntry based on a task

<parent_module>

TEXT

specifies the name of the module in which a related record needs to be created.

<record_id>

NUMBER

specifies the ID of the parent record.

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

<record_value>

KEY-VALUE

specifies the values of the record that needs to be created.

To learn about the mandatory fields, click here and go to <ModuleName> -> Create <ModuleName>

<connection>

(optional)*

TEXT

specifies the name of the connection.

The scopes which need to be selected are:  
- Desk.tickets.CREATE 
- Desk.tasks.CREATE 

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

Example

The following script creates a new record in the module - timeEntry related to the record in the parent module - tasks of ID - 168XXXXXXXXXXXX043, with the values - 168XXXXXXXXXXXXX005 and 2019-02-16T07:38:48.000Z  for the fields - createdBy and executedTime respectively.

recordValue = { "createdBy" : "168XXXXXXXXXXXXX005","executedTime":"2019-02-16T07:38:48.000Z"}; 
response = zoho.desk.createRelatedRecord(641XXXXXX,"timeEntry","tasks",168XXXXXXXXXXXXX043,recordValue, "desk_connection");

where,

response
variable which will hold the response returned by Zoho Desk. It represents the values of the record created.
641XXXXXX
is the NUMBER that represents the organization ID.
"timeEntry"
is the TEXT that represents the name of the Zoho Desk module in which the record needs to be created
"tasks"
is the TEXT that represents the parent module
168XXXXXXXXXXXXX043
is the NUMBER that represents the ID of parent record
recordValue
is the KEY-VALUE variable that holds the values of the record that needs to be created
 "createdBy"
 "executedTime"
are the TEXT keys that represent the attribute names as given in the Zoho Desk API
"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 related record created in the submodule.

      {
      "customFields": {
      "bugTimeLogID": null,
      "Date and Time Completed": null  
    },
      "ownerId": "168XXXXXXXXXXXX005",
      "requestChargeType": "Customer Service",
      "executedTime": "2019-02-16T07:38:48.000Z",
      "hoursSpent": "0",
      "minutesSpent": "0",
      "secondsSpent": "0",
      "agentCostPerHour": null,
      "additionalCost": null,
      "totalCost": "0.0",
      "description": null,
      "requestId": null,
      "createdTime": "2019-02-26T04:19:24.000Z",
      "createdBy": "168XXXXXXXXXXXX005",
      "departmentId": "168XXXXXXXXXXXX907",
      "parent": {
      "associatedTicketId": "null",
      "id": "168XXXXXXXXXXXX043",
      "type": "TASKS"  
    },
      "invoiceId": null,
      "id": "168XXXXXXXXXXXX001",
      "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 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 missing mandatory field in recordValue is of the following format.

       {
       "errorCode":"INVALID_DATA",
       "message":"The data is invalid due to validation restrictions",
       "errors":[{"fieldName":"/subject","errorType":"missing"}]}

Related Links

Get Started Now

Execute