n8n Workflow

Execute Set Node Based On Function Output

This n8n workflow automates tasks and integrates with various services. Execute Set Node Based On Function Output - ready to import and run in your n8n instance.

n8n workflow.json

About This Script

This n8n workflow automates tasks and integrates with various services. Execute Set Node Based On Function Output - ready to import and run in your n8n instance.
Features:
  • Custom JavaScript function processing
  • Conditional logic and branching
Source Code
{
    "nodes": [
        {
            "name": "On clicking 'execute'",
            "type": "n8n-nodes-base.manualTrigger",
            "position": [
                0,
                300
            ],
            "parameters": [],
            "typeVersion": 1,
            "id": "e5a516f0-21d7-40f9-8d5f-35cf5a54a92f"
        },
        {
            "name": "Function",
            "type": "n8n-nodes-base.function",
            "position": [
                200,
                300
            ],
            "parameters": {
                "functionCode": "return [\n  {\n    json: {\n      id: 0,\n    }\n  },\n  {\n    json: {\n      id: 1,\n    }\n  },\n  {\n    json: {\n      id: 2,\n    }\n  }\n];\n"
            },
            "typeVersion": 1,
            "id": "c1700da9-323a-4b6e-86b2-cd6e798600e2"
        },
        {
            "name": "Set",
            "type": "n8n-nodes-base.set",
            "position": [
                600,
                90
            ],
            "parameters": {
                "values": {
                    "string": [
                        {
                            "name": "name",
                            "value": "n8n"
                        }
                    ]
                },
                "options": []
            },
            "typeVersion": 1,
            "id": "b18a75b1-9d22-4e4b-9df7-44df4b4045be"
        },
        {
            "name": "Set1",
            "type": "n8n-nodes-base.set",
            "position": [
                600,
                230
            ],
            "parameters": {
                "values": {
                    "string": [
                        {
                            "name": "name",
                            "value": "nodemation"
                        }
                    ]
                },
                "options": []
            },
            "typeVersion": 1,
            "id": "4c51bef2-fbd4-4067-9ce6-a0fb8e47beb4"
        },
        {
            "name": "Switch",
            "type": "n8n-nodes-base.switch",
            "position": [
                400,
                300
            ],
            "parameters": {
                "rules": {
                    "rules": [
                        {
                            "operation": "equal"
                        },
                        {
                            "output": 1,
                            "value2": 1,
                            "operation": "equal"
                        },
                        {
                            "output": 2,
                            "value2": 2,
                            "operation": "equal"
                        }
                    ]
                },
                "value1": "={{$node[\"Function\"].json[\"id\"]}}",
                "fallbackOutput": 3
            },
            "typeVersion": 1,
            "id": "889f9b78-7cf1-4806-b16f-e2737176d89d"
        },
        {
            "name": "Set2",
            "type": "n8n-nodes-base.set",
            "position": [
                600,
                370
            ],
            "parameters": {
                "values": {
                    "string": [
                        {
                            "name": "name",
                            "value": "nathan"
                        }
                    ]
                },
                "options": []
            },
            "typeVersion": 1,
            "id": "28f0bfb3-619e-47ba-a443-a1c06f415edd"
        },
        {
            "name": "NoOp",
            "type": "n8n-nodes-base.noOp",
            "position": [
                600,
                510
            ],
            "parameters": [],
            "typeVersion": 1,
            "id": "ae3da77d-5f53-4648-ae15-5dfc0c18eae7"
        }
    ],
    "connections": {
        "Switch": {
            "main": [
                [
                    {
                        "node": "Set",
                        "type": "main",
                        "index": 0
                    }
                ],
                [
                    {
                        "node": "Set1",
                        "type": "main",
                        "index": 0
                    }
                ],
                [
                    {
                        "node": "Set2",
                        "type": "main",
                        "index": 0
                    }
                ],
                [
                    {
                        "node": "NoOp",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Function": {
            "main": [
                [
                    {
                        "node": "Switch",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "On clicking 'execute'": {
            "main": [
                [
                    {
                        "node": "Function",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    },
    "n8n_version": "1.5.0"
}
Requirements
n8n instance, API credentials for connected services
Tags
#n8n #automation #workflow
Quick Actions
More in n8n Workflows