Code examples for bulk record retrieval

Introduction

This article introduces how to implement the three methods for bulk record retrieval using JavaScript by showcasing code examples.

There are three main methods for retrieving records in bulk:

For more information about the differences between the three methods and their suitable scenarios, refer to The three methods for bulk record retrieval article.

Setting up the Example App

Step 1: Add the Ticketing App

Navigate to the Kintone Marketplace and search for the Ticketing App. The App is within the NPO Scenario section. Add this App while the option for With Sample Data is checked. The code examples refer to the default field codes of the Ticketing App, so there is no need to modify the App to execute the example bulk record retrieval code.
For help with creating Apps from the Kintone Marketplace, refer to the Creating an App from the Marketplace article in the Kintone Help Center.

Step 2: Bulk Record Retrieval Code Setup

Save the sample function for each bulk record retrieval method and the example to call each function as JavaScript files. Then upload the files in the JavaScript and CSS Customization settings, as shown below:

JavaScript and CSS Customization settings with Seek Method and Example Params JS files uploaded

Walkthrough Video

The video below illustrates the steps described in the article to install and configure the example App and execute the example parameters to perform record retrievals.

 

Example of calling the functions

The example functions using the three bulk record retrieval methods can be called using the following code.

Line 17 will call the bulk record retrieval method with the default parameters.

The parameter configured from Line 44 to Line 52 queries for specific records. Only records created within this year and with status set to "Not Started" will be retrieved.
If a user changes a record's status to "Active", that record will not be retrieved.

For more information on queries, refer to the Get Records API article to see the list of queries that can be used.

 

Method 1: the seek method

This method uses the Get Records API to sort and retrieve the records by the Record ID (in ascending order).
For more information on the seek method and the suitable scenarios in using it, refer to the Seek Method section of The three methods for bulk record retrieval article.

 

The code below retrieves records in bulk using the seek method:

 

Method 2: the Cursor API method

This method uses the Get Cursor API to retrieve the records.
For more information on the Cursor API method and the suitable scenarios in using it, refer to the Cursor API Method section of The three methods for bulk record retrieval article.

 

The code below retrieves records in bulk using the Cursor API method:

 

Method 3: the offset method

This method uses the Get records API to retrieve records sequentially by specifying the offset as a request parameter.
For more information on the offset method and the suitable scenarios in using it, refer to the offset method section of The three methods for bulk record retrieval article.

 

The code below retrieves records in bulk using the offset method:

 

Finally

This article introduced how to use the following three methods for bulk record retrieval with Javascript code examples: the seek method, the Cursor API method, and the offset method. The methods vary in performance, complexity, and limitations, thus understanding their differences is essential when creating Kintone plug-ins and customizations. For more information about the differences between the three methods and their suitable scenarios, refer to The three methods for bulk record retrieval article.

Given the upcoming implementation of the offset parameter's upper limit of 10,000, make sure to revise programs with the optimal record retrieval methods.

Was this article helpful?
0 out of 0 found this helpful
Do you have any questions or issues related to this article?
Please share your views with us in the Community forums!