Get Records
Table of Contents
Overview
The zoho.creator.getRecords task is used to fetch records from the specified report of the Zoho Creator application.
Syntax
<variable> = zoho.creator.getRecords(<owner_name>, <app_link_name>, <report_link_name>, <criteria>, <from_index>, <limit>, <connection_link_name>);
where:
Parameter | Data Type | Description |
<variable> | KEY-VALUE | Variable that will hold the returned response. |
<owner_name> | TEXT | Name of the owner of the app from which the records need to be fetched. Note: Name of the application owner can be fetched in the following ways:
|
<app_link_name> | TEXT | Link name of the application from which the records need to be fetched. Note: Link name of the application can be fetched in the following ways:
|
<report_link_name> | TEXT | Link name of the report from which the records need to be fetched. Note:
|
<criteria> | TEXT | The condition based on which the records need to be fetched. Note:
|
<from_index> | NUMBER | Starting index of the records (that meet the criteria) from where the records need to be retrieved. Start index: 1 |
<limit> | NUMBER |
|
<connection_link_name> | TEXT | Name of the Zoho Creator connection. Note:
|
Example 1: Fetch records from the specified report
The following example fetches records without a specified condition, start index, or record limit from Zoho Creator:
response = zoho.creator.getRecords("Shawn","Task_Management", "All_Tasks", "", 1, 200, "creator_oauth_connection");
where:
response
"Shawn"
"Task_Management"
"All_Tasks"
"creator_oauth_connection"
Example 2: Search using criteria
Assume that we have a form with the two fields - Task_Name (Single Line Field Type) and Task_Description (Single Line Field Type) in the application - Task_Management. The following example fetches the records that hold the value - ServiceTask against the Task_Name field from the report - All_Tasks.
response = zoho.creator.getRecords("John","Task_Management","All_Tasks","Task_Name == \"ServiceTask\"", 1, 200, "creator_oauth_connection");
where:
response
"John"
"Task_Management"
"All_Tasks"
"Task_Name == \"ServiceTask\""
Example 3: Fetch first 100 records
The following example fetches the first 100 records from the specified report of your Zoho Creator application:
response = zoho.creator.getRecords("Shawn","Task_Management","All_Tasks","",1,100, "creator_oauth_connection");
where:
response
"Shawn"
"Task_Management"
"All_Tasks"
""
1
100
Example 4: Search using criteria with a lookup field
Assume that we have a form with a lookup field - Department (Lookup Field Type) which refers to the form - Department. The Department form contains a field - Name (single line field type). The following example fetches the records from the report - All_Employees if the looked up record holds the value - Electrical against the field - Name .
response = zoho.creator.getRecords("Tony","Employee_Management","All_Employees","Department.Name == \"Electrical\"", 1, 200, "creator_oauth_connection");
where:
response
"Tony"
"Employee_Management"
"All_Employees"
"Department.Name == \"Electrical\""
Response Format
Success ResponseThe successful response will be returned in the following format:
{
"code": 3000,
"data": [
{
"Task_Name": "Priority Task",
"Task_Description": "I need help installing my air conditioner",
"ID": "3605445000000075003"
},
{
"Task_Name": "Support Ticket1",
"Task_Description": "Toaster Configurations",
"ID": "3605445000000065010"
}
]
}
records = response.get("data"); for each var in records { info var.get("ID"); }
The failure response for incorrect or non-existent application name will be returned in the following format
{
"code": 2892,
"message": "No application named <application_name> found. Please check and try again."
}The failure response for incorrect owner name will be returned in the following format
{
"code": 1110,
"message": "No workspace named <owner_name> found. Please enter a valid workspace value."
}The failure response for incorrect or non-existent report name will be returned in the following format
{
"code": 2894,
"message": "No report named <report_link_name> found. Please check and try again.""
}