This tutorial will help to understand how to retrieve and utilize values from records in the Kintone record list page. To retrieve and utilize values from the record details page, check the following tutorial: Retrieve Record Data (Record Details).
This tutorial will use the retrieved values to add colors to the record list fields.
First, create a Kintone app that will record choices of fruits from the options of apple, banana, and avocado. Use a Drop-down field with the field settings as below. Make note of the field code of this field as it will be used later. After saving the App, add some records.
Step 1. Retrieve values from the event object
The Event object will be used here. Review the last tutorial in the Retrieve Record Data (Record Details) article for more details on the Event object.
Below are the properties of the event object for the desktop, which can be found in the Record List Event article.
A Kintone view can be created as either a list view, calendar view, or custom view. In this case, use the most common list view, which lists the records in the App like a spreadsheet.
When the event object holds the viewType property as a list, there will be an array object in the records property. The fruit value of the x-th record can be obtained using:
The code sample below displays the retrieved records in the space under the menu in a record list page.
The data retrieved may have different formats depending on their Field Types. This is the same as the Retrieve Record Data (Record Details) article. Notice that the date format for the Created datetime field is different in the record list when compared to the values in the newly created table (which was created from the event object). Find more detail in the Kintone REST API Overview for date formats.
Compare the original record list and the sample table made by values from the event object. The sorting, number of records shown, filtering, and paging should match the original record list. You can see that the event object is useful when you need to utilize values from the record list page.
Step 2. Retrieve the field element
To retrieve the DOM element of the HTML, use this sample code here. The Get Record List Field Elements will retrieve the field element of the fruit field.
Take note of the docs written about the response for this API:
When using this API, the field elements of the area highlighted below will be responded as an array.
Step 3. Customize the record list page
Start customizing the record list page with the following sample code.
The sample should change the colors of the fields depending on the field values of each record.
We hope this has helped you understand on how to use the Event object. Go ahead to try out your own customizations on Kintone!