Globals

Read and update persistent globals across workflows

Overview

This node manages persistent global variables that can be shared across workflows or stored locally. It supports operations to get, set, increment, delete, and list these globals. The data can be persisted in a JSON file on disk, or stored in-memory at the node or workflow level.

A common use case is to maintain counters, flags, or configuration values that need to persist beyond a single workflow execution. For example, you could keep track of how many times a workflow has run, incrementing a counter each time, or store a global API rate limit value accessible by multiple workflows.

The Increment operation specifically increases a numeric global value by a defined step, optionally initializing it if missing. This is useful for counting events or generating sequential numbers.

Properties

Name Meaning
Storage Where to keep persistent data:
- File (JSON file on disk)
- Node (node-level static data)
- Workflow (workflow-level static data)
Key The key name of the global variable to operate on.
Step The amount to increment the current numeric value by (default is 1).
Initialize if Missing Whether to initialize the key with zero if it does not exist before incrementing (true/false).
Store File Path Optional path to the JSON file used to persist globals when using File storage. Defaults to user n8n folder.

Output

The output is an array of objects, each containing a json property with the following structure for the Increment operation:

{
  "key": "theKeyName",
  "value": 123
}
  • key: The global variable key that was incremented.
  • value: The new numeric value after incrementing.

If an error occurs and "Continue On Fail" is enabled, the output will contain an object with an error field describing the issue.

No binary data is output by this node.

Dependencies

  • Requires access to the local filesystem if using File storage to read/write the JSON file.
  • When using Workflow or Node storage, requires the workflow to be actively running (not manual mode) to access static data.
  • No external APIs or credentials are required.

Troubleshooting

  • Error: "Key is required"
    Occurs if the Key property is empty. Ensure a valid key string is provided.

  • Error: "Existing value is not a number"
    Happens if the key exists but its value is not numeric when trying to increment. Fix by resetting the key to a number or deleting it first.

  • Error: "Key missing and initIfMissing is false"
    If the key does not exist and initialization is disabled, increment cannot proceed. Enable "Initialize if Missing" or create the key beforehand.

  • File permission errors
    When using File storage, ensure the node process has read/write permissions to the specified JSON file path.

  • Data not persisting in Node or Workflow storage
    These storages only persist during active workflow runs; data will reset between executions or if run manually.

Links and References

Discussion