Variables Set icon

Variables Set

Set global variables (alternative to paid Variables feature)

Overview

This node allows users to manage global variables within their n8n workflows without requiring the paid Variables feature. It supports setting single or multiple variables, deleting individual variables, and clearing all stored variables.

A common use case is when you want to persist data across workflow executions or share data between different parts of a workflow. For example, you might store an API token once and reuse it later, or accumulate counters or flags that influence workflow logic.

The "Clear All Variables" operation specifically deletes all stored variables after user confirmation, which is useful for resetting state or cleaning up before starting fresh.

Properties

Name Meaning
Confirm Clear All Boolean flag to confirm that you want to delete all variables. Must be set to true to proceed with clearing all variables.

Output

The output JSON contains information about the result of the clear operation:

  • operation: The string "clear" indicating the performed operation.
  • clearedCount: Number of variables that were deleted.
  • success: Boolean indicating if the operation was successful (always true if no error).

Example output JSON:

{
  "operation": "clear",
  "clearedCount": 5,
  "success": true
}

No binary data is produced by this operation.

Dependencies

  • Uses an internal variable storage system implemented in a shared module.
  • No external services or APIs are required.
  • Requires proper configuration of the node within n8n to access and modify global variables.

Troubleshooting

  • Error: "You must confirm clearing all variables"
    This error occurs if the "Confirm Clear All" property is not set to true. To resolve, ensure you explicitly confirm the action by enabling this boolean property to prevent accidental deletion.

  • General errors during clearing
    If any unexpected error occurs, check that the node has appropriate permissions and that the environment supports variable storage.

Links and References

Discussion