Record Details Event

Contents

Record Details Events

Onload Event (desktop) - app.record.detail.show

An event triggered after the record details page is displayed on the desktop.

Record Detail Event(Desktop)
Function

app.record.detail.show

Triggered Timing
  • After displaying the record details page.
    Note that this also includes timings such as:
    • when viewing the record details page through notifications
    • after displaying the next record by clicking the “next” and “previous” icons
    • after clicking “Save” or “Cancel” on the record edit page
    • after the status of the process management has been proceeded
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

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.

Onload Event (mobile) - mobile.app.record.detail.show

An event triggered after the record details page is displayed on the mobile.

Record Detail Event(Mobile)
Function

mobile.app.record.detail.show

Triggered Timing
  • After displaying the record details page.
    Note that this also includes timings such as:
    • after clicking “Save” or “Cancel” on the record edit page
    • after the status of the process management has been proceeded
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

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.

Delete Submit Event - app.record.detail.delete.submit

An event triggered when the “Delete” button is clicked on the pop-up that appears when you delete a record on the record details page.

Delete Submit Event
Function

Desktop

app.record.detail.delete.submit

Mobile

mobile.app.record.detail.delete.submit

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.
Running actions after waiting for asynchronous operations to finish

By returning a kintone.Promise object, you can delete the record after waiting for asynchronous operations to finish. Refer to the sample code for the “When Clicking the Save Button” event on the Record Create page .

Available Event Object Actions

None

Notes
  • If false is returned, the deletion will be cancelled.

Proceed Process Event - app.record.detail.process.proceed

An event triggered when the “Update Status” is clicked for the business process feature.

Proceed Process Event
Running actions after waiting for asynchronous operations to finish

By returning a kintone.Promise object, you can update the status of the record after waiting for asynchronous operations to finish. Refer to the sample code for the “When Clicking the Save Button” event on the Record Create page .

Notes
  • Some processes need several assignees to perform an action before moving onto the next status - this event will take place even when the status does not change.
  • The record data can be updated by returning the event object.
  • Actions can be cancelled by returning false.
  • Actions can be cancelled including an error message, by setting an error property in the event object and returning it. The string in the error property will be displayed as an error message.
  • Actions will be canceled with an error, if an invalid value is returned.
  • If nothing is returned, only the status will be updated
Function

Desktop

app.record.detail.process.proceed

Mobile

mobile.app.record.detail.process.proceed

Properties of the Event Object
PROPERTY TYPE DESCRIPTION
action Object The action that was run.
// The key of the object
{ “value”: “action_name” }
status Object The status before the update
// The key of the object
{ “value”: “status_name”}
nextStatus Object The status after the update
// The key of the object
{ “value”: “status_name”}
Note that the status after the update is retrieved even if the status does not change after the action.
record Object The record object
type String The event type.
Available Event Object Actions
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 the process has progressed, 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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
kintone.events.on('app.record.detail.process.proceed', function(event) {
  var record = event.record;
  record.text_0.value = 'Overwrite with this value';
  record.Table.value[0].value.text_in_table.value = 'Overwrite first line of the table';

  // Add a row to the end of a subtable
  var newRow = {
    value: {
      text_in_table: {
        type: 'SINGLE_LINE_TEXT',
        value: 'New value for new row'
      },
      number_in_table: {
        type: 'NUMBER',
        value: '777'
      }
    }
  };
  record.Table.value.push(newRow);
  return event;
});

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.

Overwrite field values
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.