Skip to main content

Add a row to a table

Stepadd-rowsaveside effects

Adds the details found as a row in one of your tables, or updates the row with the same key.

At a glance​

PropertyValue
Step nameadd-row
ResourceClusterStep (lumen.ai/v1alpha1)
Palette group, categorysave, tables
Credits1 credit each time it succeeds
Side effectsyes It changes something outside Lumen, so a retry asks first and a test shows what it would do instead of doing it.
Installation must providenothing

Inputs​

PropertyValue
Needsfields
Producesfields
Works onitem one document at a time

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See Documents and data.

Outputs​

A later node references an output as {nodeId.field} in text, or nodeId.field in a condition.

OutputType
rowIdstring
rowCreatedboolean

Settings​

Set under config: on the flow node. Text settings may contain {nodeId.field} placeholders.

SettingTypeDefaultDescription
sheetrequiredstring-Name of the table to add the row to.minLength 1
basestring-Name of the base (database) the table is in. Optional: when set, the table must belong to this base.minLength 1
mappingmap of string-Mapping says what goes in each column: a column name to "{field}" (that field's value), or to text with {placeholders} in it, or to a plain value. A column left out takes the field of the same name.
modestring"insert"Mode is insert (the default: always a new row) or upsert (set the values on the row with the same key, or add one; the Sheet needs a key).one of insert, upsert

The full JSON Schema of these settings: add-row.schema.json.

Example​

Add a new supplier to the Suppliers table

config
mapping:
city: '{city}'
contact: '{contact}'
name: '{name}'
status: '{status}'
mode: insert
sheet: Suppliers

Use it in a flow​

A node that runs add-row goes under spec.nodes of a Flow. Give it any id, and list the next node ids in next.

flow.yaml
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
name: my-webhook
namespace: tenant-acme
spec:
classRef: {name: webhook}
config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: add-row-example
namespace: tenant-acme
spec:
displayName: "Add a row to a table"
triggers:
- id: start
ref: {name: webhook-received}
connectorRef: {name: my-webhook}
next: [add-row]
nodes:
- id: add-row
stepRef: {name: add-row}
config:
mapping:
city: '{city}'
contact: '{contact}'
name: '{name}'
status: '{status}'
mode: insert
sheet: Suppliers