> ## Documentation Index
> Fetch the complete documentation index at: https://docs.noclick.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Variables and state

> Store named values with the Set Variable node and keep persistent state for code with the State Manager node.

Two different nodes, two different jobs: Set Variable names values for easy referencing anywhere in the workflow; State Manager gives a code node a persistent memory that survives across runs.

## Set Variable

The Set Variable node stores one or more name + value pairs. Each value can be a literal or a reference like `{{form.campaign_name}}`. After the node runs, every variable is available anywhere in the workflow as `{{vars.name}}`, with no node ID needed.

| Field         | What it does                                                       |
| ------------- | ------------------------------------------------------------------ |
| **Variables** | List of assignments, each with a **Variable Name** and a **Value** |

The latest values are also saved with the workflow, so `{{vars.name}}` still resolves in later runs and in partial runs that don't re-execute the Set Variable node.

**Example:** a setup form collects a spreadsheet URL once; a Set Variable node stores it as `sheet_url`, and every Sheets node in the workflow references `{{vars.sheet_url}}` instead of repeating the form reference.

## State Manager

The State Manager node holds a JSON state object scoped to that node within the workflow, persisted in the database across runs.

| Field     | What it does                                                                                                     |
| --------- | ---------------------------------------------------------------------------------------------------------------- |
| **State** | Default values, e.g. `{"counter": 0, "items": []}`. Persisted state from previous runs overrides these defaults. |

Connect the State Manager to a [Serverless Function node's](/logic/code) state handle. The current state is injected into your code as a `state` parameter; mutate it directly (`state.counter += 1`) and the changes are saved back automatically after the code runs. The next run, even days later, starts from the saved state.

**Example:** a scheduled scraper keeps `state.seen_ids` in a State Manager so each run only processes items it hasn't seen before.

<Note>
  Use Set Variable for values you reference across nodes in a run. Use State Manager when code needs memory that accumulates across runs.
</Note>

## Next steps

* [Code](/logic/code)
* [Data references](/editor/data-references)
