Skip to main content

Delete Variable

Controlled node

Overview

The Delete Variable node removes a variable from the workflow's local variable store. This is useful for cleaning up temporary data, removing sensitive information after use, or managing memory in long-running workflows.

Unlike the Set Variable node, Delete Variable only operates on local workflow variables (not global variables) and does not require specifying a scope.

Dynamic Variable Names

The Name input supports Handlebars templating syntax ({{variableName}}). When you include template variables in the name field, additional input sockets are automatically created to accept values for those variables, allowing you to construct dynamic variable names at runtime.

Inputs

InputTypeDescriptionDefault
RunEventFires when the node should execute and delete the variable.-
NameTextThe name or path of the variable to delete. Supports dot notation for nested properties (e.g., user.profile.tempData) and Handlebars templates.-

Dynamic Inputs

When the Name field contains Handlebars template syntax (e.g., {{prefix}}_tempData), the node automatically generates additional input sockets matching the template variable names (e.g., an input called prefix). These inputs accept the values needed to construct the final variable name at runtime.

Outputs

OutputTypeDescription
DoneEventFires when the variable has been successfully deleted (or if the variable did not exist).

Runtime Behavior and Defaults

  • Scope: This node only deletes variables from the local workflow scope. It cannot delete global variables set with the isGlobal flag on the Set Variable node.
  • Path Support: Supports nested path deletion using dot notation (e.g., deleting user.settings will remove the entire settings object, while user.settings.temp removes just the temp property).
  • Missing Variables: If the specified variable does not exist, the node completes silently without throwing an error.
  • Template Resolution: If using Handlebars syntax in the name field, the template is resolved at runtime using available workflow variables and connected inputs before deletion occurs.

Example Usage

Basic Variable Cleanup

Use this node to clean up temporary calculation variables after they've been used:

  1. Create a variable using Set Variable with name tempCalculation
  2. Process your data using the variable
  3. Connect the final node's Done event to the Delete Variable node's Run input
  4. Set the Delete Variable Name to tempCalculation
  5. The variable is removed from memory when the workflow reaches this node

Dynamic Variable Deletion

Delete variables with dynamically constructed names:

  1. Set the Name input to {{userId}}_sessionData
  2. The node automatically creates an input socket called userId
  3. Connect a data source (e.g., from a form or database) to the userId input
  4. When run, if userId is "user123", the node deletes the variable named user123_sessionData

Nested Property Removal

Remove specific properties from an object without deleting the entire object:

  • Name: user.profile.temporaryToken
  • This removes only the temporaryToken property from the user profile object, leaving other profile data intact.