This could be a silly question - I tend to reference a code node ‘SetConfig’ for fields that I’ll later use in various API nodes and then I duplicate those API nodes later on in my workflows, I’m lazy and don’t alter the later pasted API nodes, but I want them to use ‘updated’ state data
Maybe I’m not thinking about this correctly but is possible to alter the contents of a previous nodes output so that I don’t have to go and re-configure the parameters of subsequent LATER API nodes to use new coded references ?
note I can’t use INPUT from previous node because my node outputs will sometimes wipe clean any output.
Maybe my question is … is there node that stores a STATE variable ?
What is the error message (if any)?
Not really … it just uses previous values… which is obviously ok … but I was wondering if I should/could alter them in future coding…
Please share the workflow
This is a VERY VERY simplistic way of seeing what I’m trying to do… I hope it explains it… Look at the two slack api nodes …
Share the output returned by the last node
Information on your n8n setup
n8n version: Tried on: 0.198.2 and 0.205.0
Database you’re using (default: SQLite): default
Running n8n with the execution process [own(default), main]: main
Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker hosted
Have you looked at staticdata? This will exist within the workflow and also between executions.
Also to be sure you know this, you can simply reference others nodes within your workflow and getting data from there. You do not need to copy the same data everytime. Doesn’t work with writing data to that node.
Ok I see the good / bad sides of the getWorkflowStaticData… it’s making my simple test a bit tricky as it just hangs When I clicked on execute workflow … then I read it needs to be an active workflow, called by a trigger/webhook.
I’m re-reading your statement about ‘Doesn’t work with writing data to that node’ trying to understand what you mean by that.
I am not completely sure on your usecase so wanted to make sure to mention you can access data from others nodes (also when not directly connected) but you cannot modify that data or anything like that.
Probably not what you are doing, just tried to be complete.
Yeah pretty much. Now that I understand once flow has passed a node you’re not able to update that specific code nodes data unless you pass thru it again and there’s logic in the code node function.
it’s just because when you take for example the Slack node,
I’m using info from the SetConfig node, but because I don’t want to go and re-edit my ‘Channel’ field for notifications to a different ‘node’ and user when workflow has progressed 10 steps along… e.g. notifications to a different person. e.g. SlackUser → SlackBoss
I’m guessing that I’ll have to think more creatively in the workflow logic or see if I can use the Global Data in this instance.