Fetch records from Zoho Desk
Table of Contents
Overview
This task is used to fetch records from the specified Zoho Desk module.
Syntax
<variable> = zoho.desk.getRecords(<orgId>, <module_name>, <fromIndex>, <limit>, <query_value>, <connection>);
where,
Parameter | Data type | Description |
<variable> | KEY-VALUE | Variable which will hold the response returned by Zoho Desk. It represents the list of records fetched. |
<orgId> | NUMBER | specifies the organization ID of the account from which the records will be fetched. This can be found in Zoho Desk Settings > Developer Space > API. |
<module_name> | TEXT | specifies the module from which the records will be fetched. The following is the list of supported modules.
|
<from> (optional) | NUMBER | specifies the index of the record from which the records will be fetched. Note:
|
<limit> (optional) | NUMBER | specifies the number of records which will be fetched. Note:
|
<query_value> (optional) | KEY-VALUE | Query to include secondary information related to the selected module. To learn about the applicable values, click here and go to <ModuleName> -> List all <ModuleName> To ignore the secondary information, specify empty map. Note: This is a mandatory param when used in Zoho Creator. |
<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 fetches all the records from Zoho Desk module - Contacts.
queryValue = {"":""}; response = zoho.desk.getRecords(641XXXXXX, "contacts", 1, 10, queryValue, "desk_connection");
where,
response
641XXXXXX
"contacts"
1
10
"desk_connection"
Sample Response
Success Response
The success response returned is of the following format.
{
"data": [
{
"firstName": "Ben",
"lastName": "Williams",
"email": "ben@zylker.com",
"secondaryEmail": null,
"mobile": null,
"phone": "+1 678 XXX XXXX",
"type": null,
"ownerId": "168XXXXXXXXXXXX005",
"accountId": "168XXXXXXXXXXXX097",
"photoURL": null,
"zohoCRMContact": {
"id": "230XXXXXXXXXXXXX044",
"type": "new"
},
"customerHappiness": {
"badPercentage": "0",
"okPercentage": "0",
"goodPercentage": "0"
},
"webUrl": "https://desk.zoho.com/support/smith/ShowHomePage.do#Contacts/dv/bf5c8fXXXXXXXXXXXXXXXXX411872c0a55fabae67fb0",
"id": "168XXXXXXXXXXXX001"
},
{
"firstName": Tom,
"lastName": "Lewis",
"email": tom@zylker.com,
"secondaryEmail": null,
"mobile": null,
"phone": "+1 678 XXX XXXX",
"type": null,
"ownerId": "168XXXXXXXXXXXX002",
"accountId": null,
"photoURL": null,
"zohoCRMContact": {
"id": "230XXXXXXXXXXXXX020",
"type": "contacts"
},
"customerHappiness": {
"badPercentage": "0",
"okPercentage": "0",
"goodPercentage": "0"
},
"webUrl": "https://desk.zoho.com/support/smith/ShowHomePage.do#Contacts/dv/bf5c8fXXXXXXXXXXXXXXXXX6519df7cc50d48844902f0",
"id": "168XXXXXXXXXXXX040"
}
]
}
oURL": null,
"webUrl": "https://desk.zoho.com/support/smith/ShowHomePage.do#Contacts/dv/bf5c8fXXXXXXXXXXXXXXXXX6519df7cc50d48844902f0",
"id": "168XXXXXXXXXXXX001"
}
]
}
To fetch the ID of records from the response, use the following snippet:
var2 = var1.toJsonList();
for each var3 in var2
{
info var3.getJson("id");
}
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."
}