Skip to main content

sort_record_collection

Internal beta โ€” config shape is being migrated

The Automation API is an internal beta and is not released yet โ€” endpoints and payloads may change or be withdrawn without notice. This action's config is being migrated to a typed schema; the fields below reflect that in-progress shape. Always read the authoritative, live shape from GET /v1/automation/meta/action before building against it.

Sort collection โ€” sorts the records in a record collection by one or more variables. group: "action". No specific trigger context is required.

Part of the Record collections family. This page documents the typed config; for how an action sits inside an automation definition, see Actions and Action examples.

Configโ€‹

KeyTypeRequiredDescription
record_collectionreferencenoThe record collection to sort โ€” an action-variable reference to a prior action's collection output. Omitted when unset.
sortsarray of sort entriesnoOrdered list of sort entries applied to the collection. Empty when omitted.

Each entry in sorts is an object:

KeyTypeRequiredDescription
idstringnoStable entry id; server-minted when omitted, and round-trips on read.
variable_defreferenceyesThe variable to sort by โ€” a reference to one of the record collection's app fields (or a meta field).
directionenumyesSort direction.

direction tokens (lower-case): asc, desc.

Exampleโ€‹

An action entry inside an automation definition's actions[]:

{
"type": "sort_record_collection",
"config": {
"record_collection": { "kind": "variable", "source": "action", "action_type": "record_collection", "app_id": 42 },
"sorts": [
{
"variable_def": { "kind": "variable", "source": "field", "field_id": 4055, "field_type": "single_text", "previous": false, "collection": true, "triggering": false },
"direction": "asc"
}
]
}
}

Validation & behaviorโ€‹

  • Both members are optional: an omitted record_collection is dropped, and an omitted sorts defaults to the empty list [].
  • Within each sorts entry, variable_def and direction are required; id is server-minted when omitted and round-trips on a GETโ†’PUT.
  • This is a consumer action โ€” its sort keys must reference a variable scoped to the collection being sorted (a record-collection app field or meta field).
  • Sort entries are applied in the order given, so later entries act as tie-breakers for earlier ones.

See alsoโ€‹