Access Record Data with Event Objects

Contents

Overview

This article introduces how to access Kintone's record data using Event Objects. Kintone has a number of events that are triggered when users interact with the platform through the browser. Event Objects are created from these interactions. These contain data that describes the details of the page related to the interaction.

This article focuses on 3 events related to Apps. The Event Objects are outputted into the console for a closer look.

Prepare the App

Create an App (External link) with any fields inside. After activating the App, add a number of records inside.

Trigger the app.record.edit.show Event

Sample code

Prepare the following JavaScript code in a text editor and navigate to the Kintone App's settings. Upload the file into the Upload JavaScript for PC option of the JavaScript and CSS Customization settings (External link) .

1
2
3
4
5
6
(function() {
  'use strict';
  kintone.events.on('app.record.edit.show', function(eventobject) {
    console.log(eventobject);
  });
})();

After saving the settings and clicking on Update App, start editing an existing record. The event should be triggered, and the Event Object should be outputted into the console.

Details of the event object

The documentation for this event can be found here .

The event object contains details of the record being edited. This includes the App ID, the Record ID and details of the record data.

In the browser console, click through the record property to view data stored in each field of the form.

Trigger the app.record.create.show Event

Sample code

Prepare the following JavaScript code in a text editor and navigate to the Kintone App's settings. Upload the file into the Upload JavaScript for PC option of the JavaScript and CSS Customization settings (External link) .

1
2
3
4
5
6
(function() {
  'use strict';
  kintone.events.on('app.record.create.show', function(eventobject) {
    console.log(eventobject);
  });
})();

After saving the settings and clicking on Update App, start creating a new record by clicking the + button. The event should be triggered, and the Event Object should be outputted into the console.

Details of the event object

The docs for this event can be found here .

The event object contains details of the record being created. This includes the App ID, the details of the record data and a boolean named reuse. reuse is true if the record was created using the Duplicate Records (External link) feature. The event object does not contain a property for the Record ID, as the record has not been created yet.

In the browser console, click through the record property to view data stored in each field of the form.

Trigger the app.record.index.show Event

Sample code

Prepare the following JavaScript code in a text editor and navigate to the Kintone App's settings. Upload the file into the Upload JavaScript for PC option of the JavaScript and CSS Customization settings (External link) .

1
2
3
4
5
6
(function() {
  'use strict';
  kintone.events.on('app.record.index.show', function(eventobject) {
    console.log(eventobject);
  });
})();

After saving the settings and clicking on Update App, navigate to the Record List page. The event should be triggered, and the Event Object should be outputted into the console.

Details of the event object

The documentation for this event can be found here .

The event object contains details of the list of records on the page. This includes the App ID, the record data, the size, the View ID, the View name, the offset and the date property. View the docs to see more details.

In the browser console, click through the records property to view data stored in each record.