On the workflow I am building I have the ‘error’ output of 6 nodes attatched to a gmail node. The gmail node is supposed to just send an message telling me what failed. On the ‘Subject’ line of the gmail node I want to reference the specific node that failed and caused the gmail node to excecute , e.g: ‘Node 7 Error’ . How would I do this? Is there a specific code-line I can put in the subject bar -or is there a simpler way to go about this?
In Gmail’s Subject field, enter this in Expression mode:
{{ $prevNode.name }} Error
$prevNode.name returns the name of the node that supplied Gmail’s current input. Since your error outputs connect directly to Gmail, it identifies the failed node, for example Create a file5 Error.
Easiest way is a Set node on each error branch before the Gmail node, with a field like failedNode set to that node’s name. Then the subject is {{ $json.failedNode }} failed. Or build a separate workflow with an Error Trigger and use {{ $json.execution.lastNodeExecuted }} in the subject, which fills itself in.