Get Record by ID

Table of Contents

Overview

This JS API task fetches the data of a specific record from a report. This record will be identified by the record ID that you supply in the request. Its response will contain the data of all the visible fields present in the record.

This V2 task is based on the Get Record by ID REST API V2.1.

Request Details

Syntax

ZOHO.CREATOR.DATA.getRecordById(config).then(function(response){ //callback block });

Syntax Details

The syntax holds:

  • <config> (object) - The configuration required to get a specific record from a report. This configuration includes the following parameters.
NameTypeDescription
app_name
(Optional)
string

Link name of the application from which data needs to be pulled. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>

Note: This parameter only needs to be passed when you need to pull data from other applications in the same Creator account. When not specified, data will be pulled from the current application.
report_namestringLink name of the report from which the record has to be fetched. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>
idstringRecord ID of the record that needs to be retrieved.
field_config
(Optional)
string

Fetches fields of a record based on the input value.
Possible values:

Note: This API will not fetch the record displayed in the related data blocks of the detail view.

fields
(Optional)
string

If the value of field_config parameter is given as custom, this parameter should also be included. The required fields' link names need to be mentioned as individual comma-separated strings.

Note:

  • The field link names can be found in the field properties pane of each field in the form builder.
  • Hidden fields will not be fetched. Admin Only fields will be fetched only when the requesting user is an admin in that application.
  • When a subform field's link name is specified, all visible fields within will be fetched.

Possible Errors

Refer to this page for the complete list of error codes and messages.

Sample Input

Copiedvar config = {
  app_name: "zylker",
  report_name: "All-Timesheet",
  id : "2000000193171"
};
ZOHO.CREATOR.DATA.getRecordById(config).then(function (response) {
  console.log(response);
});

Sample Response

Copiedresponse  = {
   "code": 3000,
   "data": {
       "ID": "2000000193171",
       "Name": {
         "first_name": "James",
         "last_name": "Kyle",
         "display_value": "James Kyle"
         }
     }
 }