Update related record

Update related record in Zoho Desk

Overview

This task is used to update a related record in a submodule belonging to a record in a parent module in Zoho Desk.

Syntax

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

where,

ParamsData typeDescription

<variable>

KEY-VALUE

specifies the variable which will hold the response returned by Zoho Desk. It represents the values of the record updated.

<orgID>

NUMBER

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

<sub_module> 

TEXT

specifies the name of the submodule in which the record will be updated. 

This task allows you to update:

  • a timeEntry based on a ticket

  • a timeEntry based on a task

<sub_recordID>

NUMBER

specifies the ID of the related record that will be updated.

<parent_module>

TEXT

specifies the name of the module in which the related record will be updated.

<parent_recordID>

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 new values of the record that needs to be updated.

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.UPDATE 
- Desk.tasks.UPDATE 

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

Example

The following script updates the timeEntry of ID - 168XXXXXXXXXXXX065 associated to the task of ID - 168XXXXXXXXXXXX043 with the value - 14 and 2019-02-16T07:38:48.000Z for the records hoursSpent and executedTime respectively.

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

where,

response
variable which will hold the response returned by Zoho Desk. It represents the values of the record updated.
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 updated
168XXXXXXXXXXXX065
is the NUMBER that represents the ID of the record that needs to be updated
"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 new values of the record that needs to be updated
 "hoursSpent"
 "executedTime"
are the TEXT keys that represent the attribute names as given in the Zoho Desk API. They hold the new values of the fields that need to be updated.
"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 new values of the related record updated in the submodule.

      {
      "customFields": {
      "bugTimeLogID": null,
      "Date and Time Completed": null  
    },
      "ownerId": "168XXXXXXXXXXXX005",
      "requestChargeType": "Customer Service",
      "executedTime": "2019-02-16T07:38:48.000Z",
      "hoursSpent": "4",
      "minutesSpent": "23",
      "secondsSpent": "21",
      "agentCostPerHour": "3.0",
      "additionalCost": "10.0",
      "totalCost": "23.17",
      "description": "Time Entry description",
      "requestId": null,
      "createdTime": "2019-02-26T04:19:24.000Z",
      "createdBy": "168XXXXXXXXXXXX005",
      "departmentId": "168XXXXXXXXXXXX907",
      "parent": {
      "associatedTicketId": "400XXXXXXXXXXX017",
      "id": "168XXXXXXXXXXXX043",
      "type": "TASKS"  
    },
      "invoiceId": "400XXXXXXXXXXX212",
      "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":"INTERNAL_SERVER_ERROR",
       "message":"An internal server error occurred while performing this operation."
       }
  • The failure response returned for incorrect or non-existent parent ID is of the following format.

       {
       "errorCode":"URL_NOT_FOUND",
       "message":"The URL you requested could not be found."
       }

Related Links

Share this post : FacebookTwitter

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

Write to us: support@zohodeluge.com