Related and sub-table records

Automations often need to reach beyond the trigger record — to the records it links to, or to the line items entered on it. Related records and sub-table rows look similar but behave differently in a flow, so this page covers each.

A lookup field links records in two tables. In a flow you can read across that link in either direction and write to it:

  • Read the linked records — use the Get Related step (or records_related() in code) to fetch the records tied to a source record, then a For Each loop to act on each. Get Related reads incoming links (e.g. from a Customer, its Orders) or outgoing ones (from an Order, its Customer).
  • Follow a single link inline — a single lookup field exposes {{record.lookupField.id}} and {{record.lookupField.title}} tokens, so you can reference the linked record without a step. To load its other fields, feed that id into a Get Record step.
  • Set or change a link — in Create Record or Update Record, set the lookup field to the related record's id (a {{…id}} token works). For a multiple lookup, pass a list of ids, or a multiple-field token that already holds several.
  • Iterate a multiple lookup — a multiple lookup token holds a list; loop it with For Each to process each linked record.

Sub-table records (line items)

Sub-table rows — invoice lines, order items — are weak entities: they exist only inside their parent and are saved atomically with it. That shapes what a flow can do:

  • You cannot create, update, or delete a line directly from a flow. Create / Update / Delete Record (and record_create() / record_update() / record_delete()) pointed at a sub-table are refused — line rows can only be written through the parent record form or the public API's master-detail endpoints. A flow can still write the parent's own fields.
  • Read a record's lines — use Get Related / records_related() from the parent to the sub-table, or records_query() on the sub-table filtered by its owner field, then For Each to loop the lines.
  • Skip the loop for totals — a Rollup field on the parent already holds the sum/count/average of its lines. Reference it as {{record.rollupField}} instead of summing lines yourself.
  • Triggers fire on the parent. Saving a record with its lines runs the parent's On Create / On Update automation — editing lines is part of the parent save, not a separate sub-table event. Rollups are recomputed before the trigger runs, so {{record.rollupField}} is already current inside the flow.

See also: Automations · Sub-tables (line items) · Tables and fields