Skip to main content

custom_variable

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.

Set variable โ€” computes and assigns custom variables for use by its own code and later actions. group: "action". No specific trigger context is required.

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

Configโ€‹

KeyTypeRequiredDescription
assignment_codecode valueyesThe code that computes and assigns the declared custom variables.
custom_variable_defsarray of objectsnoCustom variables this action declares for its own code and later actions. Each entry is { custom_type, label }. Empty when omitted.

custom_variable_defs[].custom_type tokens (lower-case): any, single_file, multi_file, single_link, html_table_rows. Each entry also carries a label string. Both custom_type and label are required on an entry.

Exampleโ€‹

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

{
"type": "custom_variable",
"config": {
"assignment_code": ["return { total: ", { "kind": "variable", "source": "meta", "meta_type": "app_record_id" }, " }"],
"custom_variable_defs": [
{ "custom_type": "any", "label": "Total" }
]
}
}

Validation & behaviorโ€‹

  • assignment_code is the only required member โ€” it has no canonical default. custom_variable_defs defaults to [] when omitted.
  • Each custom_variable_defs entry requires both custom_type (one of the tokens above) and label.
  • The declared variables become available to this action's own code and to later actions in the definition.
  • Beta caveat: with custom_variable_defs empty, the action still validates but has nothing to assign โ€” it silently no-ops with no per-action log. Declare at least one entry for the action to do work. (beta โ€” see GET /v1/automation/meta/action.)

See alsoโ€‹