Lola Execute Workflow icon

Lola Execute Workflow

Execute another workflow with cache options

Overview

The Lola Execute Workflow node allows you to execute another n8n workflow from within your current workflow, with flexible options for sourcing the workflow definition (from database, file, parameter, or URL) and optional caching of the output. This is useful for modularizing automation logic, reusing workflows, or dynamically loading and running workflows based on runtime parameters.

Common scenarios:

  • Running a shared sub-workflow as part of multiple larger workflows.
  • Dynamically loading and executing workflows stored in files or fetched from URLs.
  • Improving performance by caching outputs of expensive workflow executions.

Practical examples:

  • A master workflow that triggers different child workflows based on incoming data.
  • Executing a workflow stored in a version-controlled file system.
  • Fetching and running a workflow definition from a remote server.

Properties

Name Meaning
Source Where to get the workflow to execute from. Options: Database, Local File, Parameter, URL
Workflow ID The workflow to execute (required if Source is "Database")
Workflow Path The path to local JSON workflow file to execute (required if Source is "Local File")
Workflow JSON The workflow JSON code to execute (required if Source is "Parameter")
Workflow URL The URL from which to load the workflow (required if Source is "URL")
Any data you pass into this node will be output by the Execute Workflow Trigger. More info Informational notice about how input data is passed to the executed workflow.
Cache Output Whether to cache output data (enables caching functionality)
TTL Time-to-live in seconds for cached data (only shown if Cache Output is enabled)
Cache Scope Scope of the cache. Options: Workflow (global), Node (local to this node instance). Only shown if Cache Output is enabled.
Cache Store Key The cache key where the output will be stored (required if Cache Scope is "Workflow"). Only shown if Cache Output is enabled and scope is global

Output

  • The node outputs the result of the executed workflow as an array of items, each with a json property.
  • If caching is enabled and valid cached data exists, the cached output is returned instead of re-executing the workflow.
  • Each output item contains the fields produced by the executed workflow, and may include a timestamp field indicating when the workflow was run.
  • In case of error and if "Continue On Fail" is enabled, the output will contain an item with an error field describing the error message.

Example output:

[
  {
    "json": {
      "result": "some value",
      "timestamp": "2024-06-01T12:00:00.000Z"
    }
  }
]

or, on error (with Continue On Fail):

[
  {
    "json": {
      "error": "The file \"/data/workflow.json\" could not be found."
    }
  }
]

Dependencies

  • File System Access: Required if using "Local File" as the source.
  • Network Access: Required if using "URL" as the source.
  • No external API keys are required unless the executed workflow itself requires them.
  • n8n must have permission to read the specified file paths or access the provided URLs.

Troubleshooting

Common issues:

  • File Not Found: If the specified file does not exist, you will receive an error like:
    "The file \"/data/workflow.json\" could not be found."
    Resolution: Check the file path and ensure the file is accessible to n8n.
  • Invalid Workflow JSON: If the workflow JSON is malformed, an error will occur during parsing.
    Resolution: Validate your JSON before providing it.
  • Network Errors: If fetching from a URL fails (e.g., due to network issues or invalid URL), an error will be thrown.
    Resolution: Ensure the URL is correct and reachable from the n8n instance.
  • Cache Issues: If cache is enabled but the cache key is misconfigured or the TTL is too short, expected cache hits may not occur.
    Resolution: Review cache settings and adjust as needed.

Error messages:

  • "The file \"...\" could not be found." – File path is incorrect or inaccessible.
  • JSON parse errors – Provided workflow JSON is invalid.
  • Network request errors – Unable to fetch workflow from URL.

Links and References

Discussion