Record Create Event
Contents
- Record Create Events
- Onload Event (desktop) - app.record.create.show
- Onload Event (mobile) - mobile.app.record.create.show
- Save Submit Event - app.record.create.submit
- Save Submit Success Event - app.record.create.submit.success
- Field Change Event - app.record.create.change.(fieldcode)
- Event Object Actions
Record Create Events
Onload Event (desktop) - app.record.create.show
An event triggered after the record create page is displayed on the desktop.
Function
app.record.create.show
Triggered Timing
- After the record create page is displayed, i.e. when there is an
/edit
in the URL of the page. This can be displayed in the following ways:- by clicking the New record icon (the plus icon) on either the record list page or record details page.
- by clicking the Duplicate icon (the paper icon) on the record details page.
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
reuse | Boolean | true if the page is a duplicate of a record (i.e. the "Duplicate" icon was clicked on a record to display the page), false if the page is a regular record create page. |
record | Object | The record object, containing the default value of the fields. |
type | String | The event type. |
Available Event Object Actions
- Overwrite field values
- Enable/Disable field edits
- Show field errors
- Show record errors
- Run Lookup fields
- Clear copied Lookup field values
- By returning a
kintone.Promise
object in the event handler, event object actions can be processed after waiting for asynchronous processes in the event handler to finish.
Onload Event (mobile) - mobile.app.record.create.show
An event triggered after the record create page is displayed on the mobile.
Function
mobile.app.record.create.show
Triggered Timing
- After the record create page is displayed on the mobile. This can be displayed in the following ways:
- by clicking the "New" icon (the plus icon) on the record list page.
- by clicking the "Duplicate" icon (the paper icon) on the record details page.
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
reuse | Boolean | true if the page is a duplicate of a record (i.e. the "Duplicate" icon was clicked on a record to display the page), false if the page is a regular record create page. |
record | Object | The record object, containing the default value of the fields. |
type | String | The event type. |
Available Event Object Actions
- Overwrite field values
- Enable/Disable field edits
- Show field errors
- Show record errors
- Run Lookup fields
- Clear copied Lookup field values
- By returning a
kintone.Promise
object in the event handler, event object actions can be processed after waiting for asynchronous processes in the event handler to finish.
Save Submit Event - app.record.create.submit
An event triggered when the save button is clicked on the record create page.
This event does not hold the Record ID in the event object - use the
Save Submit Success Event instead to obtain the Record ID of the created record.
Function
Desktop
app.record.create.submit
Mobile
mobile.app.record.create.submit
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
record | Object | A record object that holds data inputted by the user. |
type | String | The event type. |
Available Event Object Actions
Running actions after waiting for asynchronous operations to finish
By returning a kintone.Promise
object, you can run actions after waiting for asynchronous operations to finish. If an error occurs and the Thenable
object is rejected, the event will be cancelled.
Sample Request using the kintone.Promise object returned by the kintone.api()
|
|
Sample Request using the kintone.Promise Constructor
|
|
Limitations
Refer to the Limitations section of the Event Handling page.
Save Submit Success Event - app.record.create.submit.success
An event triggered after the record has been successfully saved after clicking the save button on the record create page or the record duplicate page.
This event holds the Record ID of the created record in the Event Object.
Function
Desktop
app.record.create.submit.success
Mobile
mobile.app.record.create.submit.success
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
recordId | Number | The Record ID. |
record | Object | A record object that holds data of the saved record. If the record is successfully added and the user has no view permissions, null is returned. |
type | String | The event type. |
Available Event Object Actions
None
Sample showing the record ID saved
|
|
Sample showing a redirect to a user specified URL after saving
If a redirect URL is specified, the event handler will redirect the page to the specified URL after returning the event object.
If null
, or no value is specified, the page will not redirect.
|
|
Notes
- This event cannot be used with an app embedded on a space.
- The event will not trigger if the record does not successfully save.
Field Change Event - app.record.create.change.(fieldcode)
An event triggered when a specified field value changes when creating a new record.
Function
Desktop
app.record.create.change.(fieldcode)
Mobile
mobile.app.record.create.change.(fieldcode)
Fields that can be Specified
- Radio button
- Drop-down
- Check box
- Multi-choice
- User selection
- Department selection
- Group selection
- Date
- Time
- Date and time
- Single-line text
- Number
- Table
Make sure to specify the field codes of these fields. Nothing will happen if the field code does not exist, or a field that is not in the above list is specified.
*The timing of the event for the Single-line text is as below:
- when the focus leaves the field.
- when the Lookup field mappings have been run.
- For PC, after calculations have been applied to a Single-line text field that has the Calculate automatically option turned on.
*The timing of the event for the Number is as below:
- when the focus leaves the field.
- when the Lookup field mappings have been run.
*The timing of the event for the Table is as below:
- when a new row is added to the table
- when a row is deleted from the table
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
record | Object | A record object including data inputted by the user at the time of the event.. |
changes | Object | An object including data of changed fields and rows. |
changes.field | Object | An object of the changed field. |
changes.row | Object | An object of the changed row.
|
type | String | The event type. |
Notes
The change in value of the trigger field cannot be cancelled.
Available Event Object Actions
- Enable/Disable field edits
- Show field errors
- Show record errors
- Run Lookup fields
- Clear copied Lookup field values
- Get the object of the edited field or table row
Limitations
Refer to the Limitations section of the Event Handling page.
Event Object Actions
It is possible to perform actions such as disabling a field or displaying an error on a field by changing the properties of the event object and returning it. This section explains the available actions.
Overwrite field values
If the event handler overwrites values in the fields of the record object and returns the event object, the fields of the record are updated with those values in the object.
Sample
When adding a new record, overwrite the field "text_0" with a specified string, overwrite the first line of the table "Table", and add values into "text_in_table" and "number_in_table" that are inside a table, as a new line.
|
|
Note that when adding a new row to the table, all fields in the table must be specified, and the type
of each field must also be specified.
Fields that cannot be Overwritten
Even if the below fields are overwritten in the handler and returned, they will not take effect on the record itself.
- Calculated
- The Field Mappings targets of the Lookup field
- Attachment
Notes
- If an empty string is specified for the Radio button field, the default value of the field will be inputted.
- Values of the fields can be overwritten, even if the editing of the field has been disabled.
- If you do not have permission to add values to a particular field, the field change written in the script will not take effect for that field.
- If the handler does not return the event object, the fields will not be updated.
- If there are several handlers, the returned values from the last handler will take effect.
Enable/Disable field edits
If the event handler inputs true/false in the disabled
of a field of the record object and returns the event object, editing of those fields will become enabled/disabled.
Nothing will happen if this is applied to a field where you have no editing permissions.
Sample
When adding a new record, disable the editing of the "text_0" field when a value is selected in the drop down field "dropdown_0".
|
|
Fields where editing cannot be enabled/disabled
Even if the below fields are returned with the disabled
as true/false, they will not take effect on the record itself.
- Calculated
- The Field Mappings targets of the Lookup field
Show field errors
If the event handler inputs an error message in the error
of a field of the record object and returns the event object, an error message is displayed for the corresponding field.
In this case, the
overwriting of field values and the
enabling/disabling of field edits are canceled.
To remove error messages from fields, input null into the error
of the field, and return the event object.
Sample
Show an error message for the fields "text_0" and "dropdown_0" when changing the value of a drop down field.
|
|
Fields that don't show error messages
Even if the below fields have error messages inputted by the handler and the object is returned, they will not take effect on the record itself.
- Record number
- Created by
- Created datetime
- Updated by
- Updated datetime
- Status
- Assignee
- Calculated
Show record errors
If the event handler inputs an error message in the error
of the event object and returns the event object, an error message is displayed for the record.
In this case, the
overwriting of field values and the
enabling/disabling of field edits are canceled.
Sample
Show an error message for the record when changing a drop down field during a creation of a new record.
|
|
Run Lookup fields
If true is entered into the lookup
property, the Lookup field runs when the event is returned.
Sample
When adding a new record, the lookup a value is set into the Lookup field, and the value is looked up. Any field mappings that were set in the Lookup field settings also take place.
|
|
Clear copied Lookup field values
If CLEAR is entered into the lookup
property of the Lookup field, the values copied from the source App due to the Lookup field settings are cleared when the event is returned.
Sample
When editing a record, the values copied from the source App due to the Lookup field settings are cleared.
|
|
Get the object of the edited field or table row
An object containing data of an edited field and edited table row is retrieved.
Sample
Retrieve the object data of the field "dropdown_0" that exists inside a table, and the object data of the table row of the changed "dropdown_0" field, when the value of "dropdown_0" changes while creating a new record.
|
|