To Start Off
This tutorial will help you understand how to retrieve and utilize values from records in your Kintone record list page. If you want to retrieve and utilize values from the record details page, check the following tips: 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 choices of apple, banana, and avocado. Use a Drop-down field with the field settings as below. We will use the Field Code of this field later on, so make a note it.
After you have saved your app, add some records to it.
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" or a "calendar view". In this case, we will work with the more general "list view", which lists the lists of records in the app like a spreadsheet.
When the event object holds the viewType property as a 'list', then 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 last tutorial. In this example, we can see 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 were 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
If you want to retrieve the DOM element of the HTML, use this sample code here. This code will retrieve the field element of Fruit field.
Take note of the docs written about the response for this API:
When you use 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 your 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!