Global Constants icon

Global Constants

Global Constants

Overview

This node, named "Global Constants," is designed to inject predefined global constants into the workflow data. It retrieves a set of constants from stored credentials and adds them to each input item’s JSON data. This is useful when you want to reuse fixed values or configuration parameters across multiple parts of your workflow without hardcoding them repeatedly.

Common scenarios include:

  • Adding environment-specific settings (e.g., API endpoints, feature flags) to all items.
  • Injecting shared configuration values that other nodes can reference.
  • Centralizing constant values for easier maintenance and updates.

For example, if you have a set of constants like { "API_URL": "https://api.example.com", "TIMEOUT": 5000 }, this node can add them to every item passing through, either grouped under one key or as separate keys.

Properties

Name Meaning
Put All Constants in One Key Boolean option to decide whether to group all constants under a single key or spread them out as individual keys in the output JSON.
Constants Key Name The name of the key under which all constants will be grouped if "Put All Constants in One Key" is enabled. Default is "constants".

Output

The node outputs the input items with the global constants merged into their JSON data:

  • If Put All Constants in One Key is enabled, all constants are nested inside a single key (default "constants"). For example:
    {
      "constants": {
        "API_URL": "https://api.example.com",
        "TIMEOUT": 5000
      }
    }
    
  • If disabled, each constant is added as a separate top-level key in the JSON object:
    {
      "API_URL": "https://api.example.com",
      "TIMEOUT": 5000
    }
    

If there are no input items, the node creates one item containing the constants.

The node does not output binary data.

Dependencies

  • Requires an API key credential storing the global constants.
  • The constants must be defined in the credential before running the node.
  • No external services are called during execution; it only reads stored credentials.

Troubleshooting

  • No input items: If the node receives no input, it still outputs one item with the constants.
  • Missing or invalid credentials: The node requires valid credentials containing the global constants. If these are missing or malformed, the node will fail to execute properly.
  • Key name conflicts: When adding constants as separate keys, ensure they do not overwrite existing keys in the input JSON unintentionally.
  • Empty constants: If the stored constants are empty, the node will add an empty object or no keys depending on the grouping option.

Links and References

Discussion