Job Runner

Update or Add Record Providing the Key Value

Overview

If a record in the specified app matches the key, update it. If not, add a new record. The value of the key used to search the record is defined by the value.

Usage

Place the action Kintone connection settings before the action Update or Add Record Providing the Key Value.

As a result of the action, the updated record set is set if there are any records matching the key, or the added record is set if there are no records matching the key. However, the information in the additional record can only refer to fields set in the mapping.

For a type of Do that changes the field value, such as Set Field Value, you can pass the result value of add or update record by key value as the record parameter for further field value changes. However, it is not efficient because it will be saved to Kintone twice. It is recommended that you complete only the Update or Add Record Providing the Key Value whenever possible.

Parameter

Set Destination app, API Token, Key Fields, Key Value, and Mapping.

Destination app

Select the app with the record you want to update or add.

API token setting

Specify the API Token to access the Destination app. Choose from the actions to Set Kintone API Token.

The API Token must have view, add, and edit record permissions.

Key Field

Select the key fields to update the record.

This parameter does not accept fields that are inside tables.

Note that this parameter does not accept the following field types:

  • Category
  • Table
  • Related records
  • Field group
  • Blank space

Key Value

Enter key value for the record to be updated.

Mapping

Enter the information you want to register in the record.

See Field Mapping Description for detailed descriptions of this parameter.

You can use @out for this Mapping. If there is a record matching the key, @out refers to that record. If no record matches the key, @out is empty.

Occurrence of record Retrieval Criteria

Criteria Occurrence
When Record Is Ready It doesn’t happen.
When All Records Are Ready It doesn’t happen.

Understanding Conflict Detection

If a record exists that matches the key, an attempt is made to save over the record, but an update conflict is checked.

Similar to this Do Update Records by Key Value, you can choose whether to Check conflicts in the settings, but this Update or Add Record Providing the Key Value does not prevent you from checking for conflicts.

On the other hand, if no record matches the Key, i.e. a new record is created, the conflict is not checked.

So, if two people execute an action at the same time, you could end up with two new records with the same content. If you want to avoid this, it is highly recommended to set Prevent Duplicate Values on the key fields in the Kintone app settings.

Webhook notification

If the destination app is configured to provide a webhook notification with the add record criteria, this notification occurs when the record is added as a result of running this Do.

If the Do result is an update of an existing record, webhook notification will not fire.

Understanding how it works compared to previous versions

Starting with version 1.130 (released April 22, 2021), the behavior is changed when a new record is created without a record matching the Key.

For jobs generated using version 1.129 (released April 15, 2021) or earlier, if a new record is created with no record matching the Key, the record addition will not be reflected in Kintone when the action is completed. It will accumulate to some extent and then be reflected later.

Version 1.130 (released April 22, 2021) and later will reflect the record addition in the Kintone app when the action is complete.

関連記事