NocoDB Tool (Custom) icon

NocoDB Tool (Custom)

AI Agent tool for NocoDB rows and links

Row → Upsert

AI-generated

Summary

Upsert rows into a NocoDB table: lookup existing rows matching the provided filter groups; if exactly one matches, update it; if none match, create a new row; if multiple match and 'Error on Multiple Matches' is enabled (default), throw an error, otherwise update the first match.

Inputs

  • baseId (required) — Required resource locator for the NocoDB base (project). Choose 'From List' or 'By ID or Name'.
  • tableId (required) — Required resource locator for the table within the base. Choose 'From List' or 'By ID or Name'.
  • fieldsCollection (required) — Fixed collection of field-value pairs to set on the row. Each entry has a Field (loaded from table columns via getFields, depends on tableId) and a Value (string). Required for create and update paths.
  • filterGroups (required) — Fixed collection of filter conditions defining the upsert lookup. Conditions inside a group use AND; groups are OR-ed together. Each condition has a Field (from table columns), an Operator (eq, neq, gt, ge, lt, le, contains, not_contains, starts_with, ends_with), and a Value (string). Required.
  • workspaceId — Optional resource locator for the workspace. If omitted, defaults to the default workspace. Choose 'From List' or 'By ID or Name'.
  • viewId — Optional resource locator for a view to scope the upsert lookup to a specific view within the table. Shows when resource is row and operation is upsert.
  • upsertOptions.errorOnMultipleMatches — Boolean, default true. When enabled, the node throws an error if the upsert lookup matches more than one existing row. When disabled, it updates the first matching row.

Output shape

For each input item, one output item is produced containing the upserted NocoDB record and a '_upsertAction' string ('created' or 'updated'). The record includes all field values from the NocoDB response.

For updates, the returned record is freshly fetched via GET to ensure current data. Creates are tagged with '_upsertAction: created' and updates with '_upsertAction: updated'.

Examples

Example 1: Create a new row if no matching record exists.

Provide baseId, tableId, fieldsCollection with field-value pairs, and at least one filterGroup with a condition. Set errorOnMultipleMatches to false if multiple matches are acceptable and you want the first one used for update instead of creating.

Example 2: Update an existing row that matches filters.

Provide baseId, tableId, fieldsCollection with field-value pairs to update, and filterGroups defining the matching criteria. The default errorOnMultipleMatches=true will throw if multiple rows match; set to false to update the first match.

Links

Discussion