kintone developer network

Event Handling

Follow

Event Handling

Overview

On this page, we introduce how handlers can be attached to various kintone events. The different types of kintone events are listed in the side menu.

Register an Event Handlerkintone.events.on(event, handler())

Registers an event handler.

Function

kintone.events.on(event, handler(event))

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
event A string or an array of strings Yes The event type or array of event types, to which the event handler will bind to.
handler(event) Function(Object) Yes The handler that will run when the event is triggered.
All event objects have an event type in their type property.
After the scheduled maintenance on July 10th 2015:
If the kintone.Promise object* is returned in the handlers of the below events, they will be processed after waiting for the asynchronous operation to run:
 - Record Create Event: When Clicking the Save Button
 - Record Edit Event: When Clicking the Save Button
 - Record Details Event: Before Deleting a Record
 - Record Details Event: When Updating Business Processes
 - Record List Event: When Clicking the Save Button
 - Record List Event: Before Deleting a Record

*A kintone.Promise object is an object that holds a "then" method.
- Reference(External site)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

Response

None

Sample

// Run the event handler
var handler = function(event) {
console.log(event);
};
kintone.events.on('app.record.index.show', handler);

Delete a Handler from an Event Typekintone.events.off(event, handler())

Deletes a registered event handler from a specified event type.

Function

kintone.events.off(event, handler(event))

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
event String or Array of Strings Yes The event type or array of event types, to which the event handler is bound to.
handler(event) Function(Object) Yes The event handler that will be deleted.
Specify the same object that was used when registering the event handler.

Response

True, if any of the event handlers were successfully deleted.
False, if the specified event handlers could not be found.

Sample

// The event handler that will run
var handler = function(event) {
console.log(event);
};
// Delete the event handler
kintone.events.off('app.record.index.show', handler);

Delete all Handlers from an Event Typekintone.events.off()

Deletes all registered event handlers from a specified event type.

Function

kintone.events.off(event)

Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
event String or Array of Strings Yes The event type or array of event types, to which the event handlers are bound to.

Response

True, if any of the event handlers were successfully deleted.
False, if the specified event handlers could not be found.

Sample

kintone.events.off('app.record.index.show');

Delete all Event Handlerskintone.events.off()

Deletes all event handlers.

Function

kintone.events.off()

Response

True, if any of the event handlers were successfully deleted.
False, if the specified event handlers could not be found.

Limitations

  • Can be used on both Desktops and Smartphones.
  • Cannot be used on apps attached to bodies of Spaces/Threads/Announcements.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Comments