Create record

Create record in Zoho Desk

Overview

This task is used to create a record in the specified Zoho Desk module.

Syntax

<variable>=zoho.desk.create(<orgId>, <module_name>, <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 created record.

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

<module_name> 

TEXT

specifies the module in which the record will be created

The following is the list of supported modules.

  • Tickets

  • Contacts

  • Accounts

  • Tasks

  • Products

  • Contracts

<record_value>

KEY-VALUE

specifies the values of the record that will 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.tasks.CREATE
- Desk.tickets.CREATE
- Desk.contacts.CREATE
- Desk.settings.CREATE

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

Example

The following script creates a new record in the Zoho Desk module - Tickets.

recordValue = {"subject" : "Create ticket", "departmentId":"168XXXXXXXXXXXXXX044", "contactId":"1689XXXXXXXXXXXXXX005"}; 
response = zoho.desk.create(641XXXXXX, "tickets", recordValue, "desk_connection"); 

where,

response
is the 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.
"tickets"
is the TEXT that represents the name of the Zoho Desk module in which the record needs to be created.
recordValue
is the KEY-VALUE variable that holds the values of the record.
"subject"
"departmentId"
"contactId"
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.
"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.

       {
       "ticketNumber": "119",
       "modifiedTime": "2018-10-19T06:34:43.000Z",
       "subCategory": null,
       "statusType": "Open",
       "subject": "Create ticket",
       "customFields": {},
       "dueDate": null,
       "departmentId": "168XXXXXXXXXXXX044",
       "channel": "Phone",
       "description": null,
       "resolution": null,
       "closedTime": null,
       "approvalCount": "0",
       "timeEntryCount": "0",
       "channelRelatedInfo": null,
       "responseDueDate": null,
       "isDeleted": false,
       "createdTime": "2018-10-19T06:34:43.000Z",
       "modifiedBy": "168XXXXXXXXXXXX005",
       "id": "168XXXXXXXXXXXX001",
       "isResponseOverdue": false,
       "email": null,
       "customerResponseTime": "2018-10-19T06:34:43.000Z",
       "productId": null,
       "contactId": "168XXXXXXXXXXXX005",
       "threadCount": "0",
       "priority": null,
       "classification": null,
       "assigneeId": null,
       "commentCount": "0",
       "taskCount": "0",
       "accountId": "168XXXXXXXXXXXX006",
       "phone": null,
       "webUrl": "https://desk.zoho.com/support/smith/ShowHomePage.do#Cases/dv/a23592d4XXXXXXXXXXXXXXXXXXXX68ec",
       "teamId": null,
       "attachmentCount": "0",
       "category": null,
       "status": "Open1"
       }

To get the ID of the newly created record, execute the following script:

<variable> = <response_variable>.get("Id").toLong();

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

Share this post : FacebookTwitter

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

Write to us: support@zohodeluge.com