Add a row to a table
Step
add-rowsaveside effectsAdds the details found as a row in one of your tables, or updates the row with the same key.
At a glance
| Property | Value |
|---|---|
| Step name | add-row |
| Resource | ClusterStep (lumen.ai/v1alpha1) |
| Palette group, category | save, tables |
| Credits | 1 credit each time it succeeds |
| Side effects | yes It changes something outside Lumen, so a retry asks first and a test shows what it would do instead of doing it. |
| Installation must provide | nothing |
Inputs
| Property | Value |
|---|---|
| Needs | fields |
| Produces | fields |
| Works on | item 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.
| Output | Type |
|---|---|
rowId | string |
rowCreated | boolean |
Settings
Set under config: on the flow node. Text settings may contain {nodeId.field} placeholders.
| Setting | Type | Default | Description |
|---|---|---|---|
sheetrequired | string | - | Name of the table to add the row to.minLength 1 |
base | string | - | Name of the base (database) the table is in. Optional: when set, the table must belong to this base.minLength 1 |
mapping | map 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. |
mode | string | "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
Was this page helpful?