Merge node suggestion: add option to disable triggering of previous nodes

The idea is:

The Merge node has a unique behavior in which it activates connected nodes independently (please also add an explanation in the documentation here: Merge | Docs). I think it’s something that should be configurable in the node.

My use case:

I had multiple cases in which the Merge node triggered nodes that were not supposed to be triggered (usually in an unused path of an IF node).

I think it would be beneficial to add this because:

It gives more control of the Merge node, in my personal experience it caused some really unexpected workflow behavior which was not consistent. By disabling this behavior the Merge node can be used more reliably.

Totally agree about the documentation.

However one short question regarding your use case. Would you really need a Merge-Node in this case? It sounds to me right now like in this case simply removing the Merge-Node and rather connecting directly to the node afterward is what you want and need.

Hi @Tuckan & @jan !

Gotta agree with Tuckan on this.
I encountered the problem several times myself and even blamed the IF node for it until I noticed the Merge node was the one messing up my workflow.

Pretty please. ahah !!
Cheers

Hi @jan thank you for the quick response.

For your question I tend to prefer using a single execution, it’s easier to keep track of and has less potential for bugs. (This may require a different thread but multiple executions in a Merge execute only once)
It also makes logical sense to use IF nodes to split a branch and use the Merge nodes to combine them together afterwards.

I have 2 examples of bugs occurring in relation to the Merge node and an IF node:

  1. In this simplified workflow there the if node output is a single empty item on the true path. The merge node triggers the bottom node to activate and creates an extra unwanted entity in the system.
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [
        250,
        300
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "module": "Calls",
        "action": "create",
        "fields": {
          "field": [
            {
              "name": "name",
              "value": "abc"
            }
          ]
        }
      },
      "name": "Create Entity",
      "type": "CUSTOM.suiteCRM",
      "position": [
        670,
        170
      ],
      "typeVersion": 1,
      "alwaysOutputData": true,
      "credentials": {
        "suitecrmApi": "SuiteCRM account"
      }
    },
    {
      "parameters": {
        "module": "Calls",
        "action": "create",
        "fields": {
          "field": [
            {
              "name": "name",
              "value": "aaa"
            }
          ]
        }
      },
      "name": "Create Entity Differently",
      "type": "CUSTOM.suiteCRM",
      "position": [
        670,
        390
      ],
      "typeVersion": 1,
      "alwaysOutputData": false,
      "credentials": {
        "suitecrmApi": "SuiteCRM account"
      }
    },
    {
      "parameters": {},
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        900,
        280
      ],
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": 1,
              "operation": "equal",
              "value2": 1
            }
          ]
        }
      },
      "name": "IF1",
      "type": "n8n-nodes-base.if",
      "position": [
        440,
        300
      ],
      "typeVersion": 1
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "IF1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Entity": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Entity Differently": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "IF1": {
      "main": [
        [
          {
            "node": "Create Entity",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Entity Differently",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
  1. My 2nd example is a real use case which is more complex - I get a list of items to create/delete and my implementation requires that I first delete and then create. The nodes from from the IF to the Merge are set to always pass data and the delete node is set to continue on fail.
    I tested a case with a single item that go to the false path on the IF and somehow the node on the true path used information that was only on the false path of the IF.

Hi @Tuckan

I actually got solutions for your two cases.

Case 1:

  • Remove everything but one Create Entity
  • put your conditions directly in there as follows:
{{ yourCondition ? "result if condition true" : "result if condition false" }}

If it’s an experssion just remove the quotation marks.

Case 2:

  • Disconnect the Spreadsheet file and the Merge 2nd input
  • Connect the IF true branch to the Merge 2nd input

That should do it!

But I still request that node improvement !!

1 Like

Hi @TheFSilver,

Thank you for the tips!

I mainly presented these cases to show potential bugs.
For case 1 it’s true it will work for a simple IF but if I’ll have more complex conditions it will start to get messy to try and find a workaround for each case. I wanted to present a case that Merge node always triggers a node that is on a situational path.

As for case 2 upon further testing it appears to be an issue with the SuiteCRM node ignoring a query when getting an empty value. For future reference the workaround was to add a Function Item node that set an empty string to the value if the item is empty.

Thanks a lot for providing some background information. Will be very helpful for us when we look into that further.

Hi @Tuckan,

Anytime. :slight_smile:

Just to be clear: I just provided those temporary quickfix while we wait for @jan & the team to implement the merge node improvement. :wink:

I need them too ahah.