Hi everyone,
I’m building a workflow in n8n and need help with the following scenario:
I receive a JSON with multiple order lines, many belonging to the same order.
Before the first loop, I use a Code node to group the lines by order.
Before the second loop, I use another Code node to split the lines into individual items for processing.
In the second loop, I need to perform several checks for each line:
Stock availability
Correct price
Quantity, etc.
The problem is: I need to collect all these results from each line during the iterations and, when the second loop finishes, have them all available in a Set node to:
Generate the complete order
Send notifications
I’m not sure how to store or accumulate the results from each iteration and pass them to the next node without losing data or processing it partially.
Does anyone know the best way to do this in n8n?
Any example using a Code node, Function node, or temporary variables would be greatly appreciated.
Thanks in advance! ![]()
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via Docker:
- Operating system: Windows
