I’d like to split my execution into two separate paths according to a status of a node, whether it failed on not. Note that I selected “Continue On Fail:” on that node so that execution doesn’t break.
The idea is to add an IF node following the one I’m interrogating and split the execution path from there.
My question - within the IF node, how can I query the status of the previous node (Failed, Passed)?
Welcome to the community!
Currently, there is no way to get the status of the previous node. However, there is a work around for it. The following workflow might help.
In the following workflow, I’ve also set the Always Output Data to
true for the Function node. If you change the code in the Function node to
const items.json.myvariable... it will give an error. The IF node will check for this. If the Function gives an error the IF node will return true otherwise false. Depending on the node that you have prior to the IF node, you may have to modify the condition in the IF node.
Thanks for your assistance.
I’ve taken an existing Function node, so I’m not sure I can easily change its code, as you suggested.
I’m actually looking now at the Error Trigger node, but with this case it seems that I’m losing all data captured by the nodes in the failed workflow.
The workflow that I share was an example. You will have to modify it as per your use-case. The Error Trigger node only gets the information about the workflow and the node that caused the error. It won’t get the data from the workflows.
Thank you. Indeed works well!