Set Variable
AI-generatedOverview
This node manages global configuration variables across workflows by allowing users to set, get, delete, and clear variables stored in a shared config store. It is useful for storing environment-specific settings, API keys, or any data that needs to be reused across multiple workflows. For example, you can set a project ID once and retrieve it in different workflows without hardcoding it each time.
Use Case Examples
- Set a variable named APPWRITE_PROJECT_ID with your project ID to reuse in workflows.
- Get the value of a stored variable to use in subsequent workflow steps.
- Delete a variable when it is no longer needed.
- Clear all stored variables to reset the config store.
Properties
| Name | Meaning |
|---|---|
| Variable Name | The name of the variable to set, get, or delete. Use uppercase for convention. |
| Variable Value | The value to store for the variable. Supports n8n expressions. Only used when setting a variable. |
| Options | Additional options for the operation. |
Output
JSON
_configStoreoperation- The operation performed (set, get, setMultiple, getAll, delete, clear).variable- The variable name involved in the operation (if applicable).value- The variable value, masked if marked as secure.success- Indicates if the operation was successful.found- Indicates if a requested variable was found (for get operation).error- Error message if a variable was not found (for get operation).variables- An object containing multiple variables and their values (for setMultiple and getAll operations).count- The count of variables involved in the operation (for setMultiple and getAll).deleted- Indicates if a variable was deleted (for delete operation).cleared- The number of variables cleared (for clear operation).
Dependencies
- Uses an internal Map object to store variables in memory during runtime.
Troubleshooting
- If a variable is not found during a get operation, the output will indicate 'Variable not found'. Ensure the variable name is correct and has been set previously.
- When setting a variable as secure, the value is masked in the output and logs. Make sure to handle secure variables appropriately in downstream workflow steps.
- Clearing all variables removes all stored data; use with caution to avoid data loss.