Expression: How to Get the Current Execution Output Rule Number in a “Switch” Node

Hello everyone, is there a built-in way in N8N Expressions to retrieve the output rule number (0, 1, 2, 3) of the previous step node (Switch)?

Not the Output Data just the number of rule that used to output data

Hi @anas, you can query this information using an expression of {{ $prevNode.outputIndex }}. Check out this example workflow:

No matter to which output you connect the Set node, once you run the workflow it’ll “know” where the previous item came from.

Hope this helps!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.