Record Edit Events
Onload Event (desktop)app.record.edit.show
Function
app.record.edit.show
Triggered Timing
- After the Record Edit page is displayed, i.e. when there is an mode=edit in the URL of the page.
- After the Record Edit page is displayed through a notification.
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
record | Object | The record object. |
recordId | Number | The record ID |
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.edit.show
Function
mobile.app.record.edit.show
Triggered Timing
- After the Record Edit page is displayed on the mobile.
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
record | Object | The record object. |
recordId | Number | The record ID |
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 Eventapp.record.edit.submit
Function
Desktop
app.record.edit.submit
Mobile
mobile.app.record.edit.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. |
recordId | Number | The record ID. |
type | String | The event type. |
Available Event Object Actions
Running actions after waiting for asynchronous operations to finish
By returning the kintone.Promise object, you can run actions after waiting for asynchronous operations to finish. Refer to the sample code for the "Save Submit Event" event on the Record Create page.
Limitations
Refer to the Limitations section of the Event Handling page.
Save Submit Success Eventapp.record.edit.submit.success
Function
Desktop
app.record.edit.submit.success
Mobile
mobile.app.record.edit.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. |
type | String | The event type. |
Available Event Object Actions
None
Sample
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 Eventapp.record.edit.change.<>
Function
Desktop
app.record.edit.change.<fieldcode>
Mobile
mobile.app.record.edit.change.<fieldcode>
Fields that can be Specified
The same as the "Field Change Event" event for the Record Create event.
Properties of the Event Object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
appId | Number | The App ID. |
record | Object | A record object that holds form data inputted by the user at the point of the event. |
recordId | Number | The Record ID |
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. |
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
- 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
After opening the record edit page, 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.
Also, if the first line of the table does not exist when you start editing, the code will not be able to find the first line, and will stop the script.
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 editing a 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 an edit of a record.
Run Lookup fields
If UPDATE or true is entered into the lookup property of the Lookup field, the Lookup field runs when the event is returned.
Sample
When editing a 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 editing a record.