🚨 Retrieving Workflow-Specific Variable in n8n Error Handler Workflow 🚨

Hello everyone, how are you doing?

PROBLEM
I’d like to retrieve a variable called extraction_id from a Workflow that encountered an error in the error workflow (which contains an Error Trigger node). With this key, I aim to save the error log in my database table. I’m struggling to find a way in n8n to retrieve this variable (metadata) from the Workflow.

WHAT I’D PREFER NOT TO DO

  • Use the Stop and Error node in each specific node passing the variable value. My flow has 40 nodes, and I would not like to create specific error conditions. I just want that when the flow presents an error, I can retrieve the value of extraction_id in the error flow.

POSSIBLE SOLUTIONS BUT I HAVE DOUBTS:

  • Looking at the documentation, I came across workflowStaticData, $execution.customData, and the Execution Data node. It seems that workflowStaticData only saves variables locally in the flow and I can’t retrieve this information in other flows. My hope is that with $execution.customData I might somehow retrieve this variable in other flows, BUT I DON’T KNOW IF IT’S POSSIBLE NOR HOW TO MAKE THIS RETRIEVAL VIA CODE NODE. As for the Execution Data node, it’s not clear in the documentation if it’s possible to retrieve this metadata information in another flow and neither how I could do it if it were possible.

IF THERE IS NO AVAILABLE OPTION TO RETRIEVE THE VARIABLE

  • In this case, I’ll have to use a database to link the variable to the execution id and retrieve this information. It would be more laborious, but it’s a path to a solution.

Could someone help me?

Thank you in advance!!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Information on your n8n setup

  • n8n version:1.24.1
  • **Database (default: SQLite):cloud
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):cloud
  • Running n8n via (n8n cloud): cloud
  • **Operating system:Mac OS - 14.2.1

Hello @Eduardo_Moscatelli

There is an option to store the extraction id in the workflow static data. You can retrive it in other worflows via the n8n node and get workflow operation (there will be a property named “staticData”)

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.