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 →
{
"name": "sub workflow",
"nodes": [
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "operator"
},
{
"name": "a",
"type": "number"
},
{
"name": "b",
"type": "number"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
0,
0
],
"id": "fe6227ad-62c8-46a0-b6b9-11a3b7dd1b95",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.operator }}",
"rightValue": "addition",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "1ca2a55e-382d-4d8a-9ce9-34fe5cfcd5f4"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "1386e6a3-8e85-401f-967f-9120e35d7dfa",
"leftValue": "={{ $json.operator }}",
"rightValue": "subtraction",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "08945df2-2fc8-4dc9-83c2-43f4e5649c32",
"leftValue": "={{ $json.operator }}",
"rightValue": "multiplication",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "2b2780f7-9c25-4a43-bc8d-0d14a38461ab",
"leftValue": "={{ $json.operator }}",
"rightValue": "division",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
}
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
208,
-48
],
"id": "3df55a23-fcf6-4bb1-9172-adb6ede0a73f",
"name": "Switch",
"executeOnce": false
},
{
"parameters": {
"errorMessage": "Operator does not support"
},
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
416,
288
],
"id": "145d5ad7-17d8-44e7-99cb-01e51ddb01b4",
"name": "Stop and Error"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "0a95efa4-4cb7-40a1-9197-61c5c37e85db",
"name": "result",
"value": "={{ $json.a + $json.b }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
416,
-288
],
"id": "9209725e-8dcc-4e74-a92a-b088e8a06d4c",
"name": "Edit Fields"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d94b4103-baff-45d2-821e-a095414c677a",
"name": "result",
"value": "={{ $json.a - $json.b }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
416,
-144
],
"id": "d80cf688-9d35-4ff3-87c0-8d0132b518af",
"name": "Edit Fields1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "4a1c055e-d10a-4999-8eb4-2522eba9b631",
"name": "result",
"value": "={{ $json.a * json.b }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
416,
0
],
"id": "59469c9b-cd1b-44f5-ad3e-233e4b955724",
"name": "Edit Fields2"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "160a020b-dad2-4cdc-a36a-3ba4e3795614",
"name": "result",
"value": "={{ $json.a / $json.b }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
416,
144
],
"id": "c8eb9ddf-3643-48d0-bd9f-659cb3defd6d",
"name": "Edit Fields3"
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-720,
0
],
"id": "a593792c-96db-4fed-832e-8bfeb92865ad",
"name": "When clicking \u2018Execute workflow\u2019"
},
{
"parameters": {
"jsCode": "function getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nreturn {\n operator: ['addition', 'subtraction', 'multiplication', 'division'][getRandomInt(0, 3)],\n a: getRandomInt(0, 99),\n b: getRandomInt(0, 99),\n}"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-512,
0
],
"id": "50c167ac-ba04-41eb-9578-714786e381d5",
"name": "Code"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "52KfqxMZ77A9nLwj",
"mode": "list",
"cachedResultName": "sub workflow"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"operator": "={{ $json.operator }}",
"a": "={{ $json.a }}",
"b": "={{ $json.b }}"
},
"matchingColumns": [],
"schema": [
{
"id": "operator",
"displayName": "operator",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
},
{
"id": "a",
"displayName": "a",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "number"
},
{
"id": "b",
"displayName": "b",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "number"
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.2,
"position": [
-304,
0
],
"id": "bcaa55dd-f2b7-4b2a-a382-50efbd9401e3",
"name": "Execute Workflow"
}
],
"connections": {
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields3",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Execute Workflow",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c30cacf7-fc0a-4629-9ad8-195c7cd9fbdc",
"id": "52KfqxMZ77A9nLwj",
"tags": []
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
sub workflow. Uses executeWorkflowTrigger, stopAndError. Event-driven trigger; 10 nodes.
Source: https://github.com/datawhalechina/handy-n8n/blob/d0d1f6dbb65815de8b1433dd671482f25e76122b/workflows/c04/n8n_sub_workflow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Prevent concurrent workflow runs using Redis. Uses executeWorkflowTrigger, manualTrigger, stickyNote, executeWorkflow. Event-driven trigger; 43 nodes.
This workflow sets a small "lock" value in Redis so that only one copy of a long job can run at the same time. If another trigger fires while the job is still busy, the workflow sees the lock, stops e
This template facilitates the transfer of a folder, along with all its files and subfolders, within a Nextcloud instance. The Nextcloud user must have access to both the source and destination folders
> v2: Now it can read multiple types of LLM usages. Better dynamic approach for reading model usage.
If you're in need of a quick and dirty cache that doesn't need anything other than the current version of N8N, boy do I have a dodgy script for you to try!