AutomationFlowsGeneral › Loop Test

Loop Test

Loop_Test. Event-driven trigger; 12 nodes.

Event trigger★★★★☆ complexity12 nodes
General Trigger: Event Nodes: 12 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Loop_Test",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        592,
        720
      ],
      "id": "21e39ebc-07a5-4100-ba67-9e24eb4f9cee",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "jsCode": "const N = 5;\nconst out = [];\nfor (let i = 1; i <= N; i++) out.push({ json: { idx: i, payload: `second-${i}` } });\nreturn out;\n"
      },
      "id": "e6bdd375-88b3-4c6c-89a8-56af865d5e87",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1520,
        736
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "2e8529da-9d9e-49ef-a542-0e492ef1d80f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1072,
        720
      ]
    },
    {
      "parameters": {},
      "id": "defb626e-3c93-4ea9-8502-6ca06b12a35b",
      "name": "Replace Me",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        2080,
        1056
      ]
    },
    {
      "parameters": {
        "options": {
          "reset": "={{ $node['Loop Over Items1'].context[\"done\"] }}"
        }
      },
      "id": "c39c1b13-7b08-46f5-ad44-ad73624d10a4",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1776,
        736
      ]
    },
    {
      "parameters": {},
      "id": "988a3ba0-8b39-446a-a9b2-eb7cec1c255f",
      "name": "End",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1296,
        528
      ]
    },
    {
      "parameters": {
        "jsCode": "const N = 2;\nconst out = [];\nfor (let i = 1; i <= N; i++) out.push({ json: { idx: i, payload: `first-${i}` } });\nreturn out;\n"
      },
      "id": "cfdda862-e1c5-4092-be53-c2b3ba3d9c08",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        816,
        720
      ]
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2064,
        752
      ],
      "id": "f797eb1c-0d04-474b-8f90-bafa1b2ade7e",
      "name": "Wait"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1296,
        736
      ],
      "id": "36740081-fa57-4344-b5df-7507f57662f2",
      "name": "Wait1"
    },
    {
      "parameters": {
        "options": {
          "reset": "={{ $node['Loop Over Items2'].context[\"done\"] }}"
        }
      },
      "id": "148165bc-192e-4866-a2b8-c0d6dc717d41",
      "name": "Loop Over Items2",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        2448,
        752
      ]
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2688,
        768
      ],
      "id": "fb6f2e03-c6bb-4db1-9500-11c3ddc2fcad",
      "name": "Wait2"
    },
    {
      "parameters": {
        "jsCode": "const N = 7;\nconst out = [];\nfor (let i = 1; i <= N; i++) out.push({ json: { idx: i, payload: `third-${i}` } });\nreturn out;\n"
      },
      "id": "c0181fde-5736-479f-bde1-18ced6c95081",
      "name": "Code3",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2240,
        752
      ]
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "End",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replace Me": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [
          {
            "node": "Replace Me",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Code3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items2": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "Loop Over Items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code3": {
      "main": [
        [
          {
            "node": "Loop Over Items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a2861023-f9bd-401e-b312-43c6305c8107",
  "id": "kopkGx5ReD8V73RB",
  "tags": []
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Loop_Test. Event-driven trigger; 12 nodes.

Source: https://gist.github.com/rigormortis2/645df23c7d2085a57c60059c792628f4 — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Blotato. Uses googleSheets, @blotato/n8n-nodes-blotato. Event-driven trigger; 65 nodes.

Google Sheets, @Blotato/N8N Nodes Blotato
General

This template is a hands-on, practical exam designed to help you master n8n Expressions—the key to accessing and manipulating data in your workflows.

Stop And Error
General

This template is a hands-on, practical exam designed to test your understanding of the fundamental JSON data types. It's the perfect way to solidify your knowledge after learning the basics.

Stop And Error
General

Agendamiento. Uses n8n-nodes-evolution-api, redis, dataTable, executeWorkflowTrigger. Event-driven trigger; 60 nodes.

N8N Nodes Evolution Api, Redis, Data Table +2
General

Kv Cloudflare Key Value Database Full Api Integration Workflow. Uses stickyNote, httpRequest, manualTrigger. Event-driven trigger; 47 nodes.

HTTP Request