Docs »

Automations »

Commands »

record.upsert

The record.upsert: command creates or updates a record with the given fields.



start:
  record.upsert:
    output: record
    inputs:
      record_type: task
      record_query: name:"This is a new task" status:open
      # See: https://cerb.ai/docs/records/types/task/#records-api
      fields:
        importance: 75


Syntax

inputs:

Key  
record_type: The record type to create.
record_query: The search query to match. With 0 matches the record is created. With 1 match the existing record is updated. The on_error: event is triggered otherwise. Use limit:1 and sort: in the record_query: to reduce multiple matches into one.
record_query_params: Query parameters with untrusted user input as keys/values. Reference these as ${param} in queries.
fields: The fields to set based on the record type.
disable_events@bool: Avoid triggering events for created or updated records.

output:

Save the record dictionary to this placeholder.

on_simulate:

The commands to run during simulation instead of updating the record.

If omitted, the record is updated during simulation.

on_success:

The commands to run on success.

The output: placeholder is a dictionary based on the record type.

on_error:

The commands to run on failure. If omitted, the automation exits in the error state.

The output: placeholder receives a dictionary with these keys:

Key  
error The error message.