Create record in Zoho Desk
Table of Contents
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,
Parameter | Data type | Description |
<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.
|
<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: *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
641XXXXXX
"tickets"
recordValue
"subject"
"departmentId"
"contactId"
"desk_connection"
"desk_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:
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"}]}