Get Records

Get Records

Overview

The zoho.creator.getRecords task is used to fetch records from the specified report of the Zoho Creator application.

Note: This integration task is based on the Zoho Creator V2 API - Get Records.

Syntax

<variable> = zoho.creator.getRecords(<owner_name>, <app_link_name>, <report_link_name>, <criteria>, <from_index>, <limit>, <connection_link_name>);

where:

ParameterData TypeDescription

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

  • From the URL of the application while editing or accessing it. The URL is in the format: app.zohocreator.com/appbuilder/<application_owner>/...
  • By using the system variable - zoho.adminuser

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

  • From the URL of the application while editing or accessing it. The URL is in the format: app.zohocreator.com/appbuilder/<application_owner>/<application_name>/...
  • By using the system variable -  zoho.appname
  • Link names of applications, reports, and fields in your account can also be viewed on the reference page (listed in brackets).

<report_link_name>

TEXT

Link name of the report from which the records need to be fetched.

Note:

  • Link names of applications, reports, and fields in your account can be viewed on the reference page (listed in brackets).
  • You can also fetch link names from the URL while accessing the report. The URL is in the format: app.zohocreator.com/appbuilder/<application_owner>/<application_name>/#Report:<report_link_name>

<criteria>

TEXT

The condition based on which the records need to be fetched.

Note: 

  • Click here to learn more about defining criteria.
  • To fetch records without criteria, provide an empty text as its value.
  • If your search condition contains hard-coded string value, it needs to be enclosed in double-quotes escaped with backslashes. For example, the search condition, "Task_Name==Service Task" should be provided as "Task_Name==\"Service Task\"".

<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


Number of records need to be fetched

Maximum limit: 200 records

<connection_link_name>

TEXT

Name of the Zoho Creator connection

Note:

  • The connection should be OAuth 2 based. To create OAuth 2 based connection with Zoho services, choose the default service - Zoho OAuth under pick your service in connections page.
  • Make sure to add the scopes mentioned in the Zoho Creator Get Records API document while creating the connection.

 

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
The KEY-VALUE variable that holds the response of the task
"Shawn"
The TEXT value that represents the name of the application owner.
"Task_Management"
The TEXT value that represents the link name of the application.
"All_Tasks"
The TEXT value that represents the link name of the report.
"creator_oauth_connection"
The TEXT value that represents the link name of the Zoho Creator OAuth connection created with required scopes.

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
The KEY-VALUE variable that holds the response of the task
"John"
The TEXT value that represents the name of the application owner.
"Task_Management"
The TEXT value that represents the link name of the application.
"All_Tasks"
The TEXT value that represents the link name of the report.
"Task_Name == \"ServiceTask\""
The TEXT value that represents the criteria to search for records.

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
The KEY-VALUE variable that holds the response of the task
"Shawn"
The TEXT value that represents the name of the application owner.
"Task_Management"
The TEXT value that represents the link name of the application.
"All_Tasks"
The TEXT value that represents the link name of the report.
""
The empty TEXT value that represents the records need to be fetched without any criteria.
1
The NUMBER value that represents the starting index of the records that need to be fetched.
100
The NUMBER value that represents the number of records that need to be fetched.

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
The KEY-VALUE variable that holds the records fetched from the specified report.
"Tony"
The TEXT value that represents the application owner's name.
"Employee_Management"
The TEXT value that represents the application's link name.
"All_Employees"
The TEXT value that represents the report's link name.
"Department.Name == \"Electrical\""
The TEXT value that represents the condition to search the records. Department is the link name of the looked up form and Name is the link name of the field present in the Department form.

Response Format

Success Response
  • The 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"​
     }​
     ]​
     }
To get the IDs of the fetched records, execute the following snippet:
 records = response.get("data");
 for each var in records
 {
 info var.get("ID");
 }
Failure Response
  • 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.""
    }

Related Links

Share this post : FacebookTwitter

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

Write to us: support@zohodeluge.com