The end goal is to be able to format a small report of what the workflow did in a JSON format. So I’m looking to execute a workflow in which toward the end a Code node is placed to prepare the said report. I need to identify which nodes have been executed previously.
I’m using n8n 1.56.2 self hosted on a production-ready cloud Kubernetes Cluster.
From what I found you cannot get this during the workflow execution. The $execution
variable does not contains something like $execution.currentRunData
or an updated .data.resultData.runData
as we get when using the Get Execution
n8n node.
Ideally that would be it : anywhere in the workflow we could read a variable that holds what previously happened during the current execution.
At the moment I found two workaround for this :
- Add Code nodes that execute
$execution.customData.set("key", "value")
After each ‘important node’ add a code node that will add or update some key in the $execution.customData
object.
The issue with this way is that it clutters the workflow visually with non-business oriented logic.
Exemple
- Trigger a second workflow at the end of the first one and fetch execution data from there
The other idea is to end the first workflow with an Execute Workflow
node to which you send the current execution id.
In the this second workflow you use the n8n get execution data
node and you can then parse the .data.resultData.runData
variable wich seems to hold the data of every executed node.
The issue with this way is that on heavy workflow that hold binary data you can generate > 100MB of JSON objects that could eventually make your execution crash. (at least it makes the UI crash when trying tu visualise them)
Exemple : Workflow 1
And workflow 2 to fetch first workflow’s execution data :
Is there any other way to achieve this ?
Thanks