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 Event Handlers - kintone.events.on(type, handler)
Registers an event handler.
Function
kintone.events.on(type, handler)
Parameters
PARAMETER | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
type | 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 | Function(Object) | Yes | The handler that will run when the event is triggered. All event objects have an event type in their type property. By returning a kintone.Promise object* in the event handler, the next operations can be processed after waiting for asynchronous processes in the event handler to finish:
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 |
Returns
Nothing
Sample
|
|
Remove Event Handlers - kintone.events.off(type, handler)
Removes event handlers from the specified event type(s).
Function
kintone.events.off(type, handler)
Parameters
PARAMETER | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
type | String or Array of Strings | Optional | The event type(s) to which the event handler is bound to. |
handler | Function(Object) | Optional | The handler that will be removed from the specified event type(s). If no value is set for this parameter, all event handlers will be removed from the specified event type(s). By returning a kintone.Promise object in the event handler, the next operations can be processed after waiting for asynchronous processes in the event handler to finish.If no values are set for both the type and handler parameter, then all event handlers will be removed from all event types. |
Returns
True
, if any event handlers were removed.
False
, if no event handlers were removed.
Sample
|
|
Limitations
- If there are JavaScript files for apps and plug-ins in the same app, the order in which the files are read is as follows:
- JavaScript files for apps
- JavaScript files for plug-ins
- Event handlers cannot be overwritten. The existing event handler will need to be deleted, followed by adding a new event handler.
- If there are multiple categories with the same name within the same App, at any of the following events, when returning an object containing the category property, an unintended category may be returned. To avoid this, return the object after deleting the category property.
Events:- Record List Event
- Record Create Event
- Record Edit Event
- Record Details Event