I have a node that i am having issues with using values from previous nodes.
For example.
Now these values have no issues working, and i am pulling them from 1 node back.
When i change the input dropdown to a different node or use the edit expression option to grab previous nodes, i have no issue seeing the values i want to pull in however if i try to use one it gives me an error that i cant get data for expression
ExpressionError: Canât get data for expression
at createExpressionError (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:465:20)
at getPairedItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:517:27)
at pairedItemMethod (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:734:40)
at Object.get (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:737:40)
at Proxy.eval (eval at getFunction (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:24:22), :6:57)
at Tournament.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:33:19)
at evaluateExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/ExpressionEvaluatorProxy.js:110:16)
at Expression.renderExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:217:70)
at Expression.resolveSimpleParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:195:34)
at resolveParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:276:25)
So now i will add a new parameter to the body of the node called âWorkOrderDescriptionâ and add the value linked to ânameâ in the âItems Listsâ Node. You can see the data is pulling in.
I am trying to run this api call as many times as needed with the values of each row and the api will reply back with all the remaining required fields that i then need to post back in on another step ( havenât got to that part)
Now, given all the values are mapping correctly in the input views do i still need to do this item linking thing and if so do i need to do that javascript in the values of this node?
Hi @Petero, did you add the paired/linked item logic to your code as suggested by Jan above?
If not you could alternatively consider using legacy expressions like {{ $node['Item Lists'].json.name }} which do not rely on these properties to be available, but you would need to make sure that neither the order nor number of your items change in this case.
Iâve had the same problem (I think) on a very simple flow.
In the Input area (5 nodes back) I can see the data and itâs correct, but when I drag-and-drop, I get the Can't get data: error from: {{ $('Add Form Trigger').item.json.Text_to_Add }}
But everything works when I use the legacy: {{ $node['Add Form Trigger'].json.Text_to_Add }}
@RichardC, it is a known âproblemâ when the required pairedItem information is not provided in a code-node. Does your Workflow use a Code-Node and if that is the case, did you provide the pairedItem information?
If it does not contain a Code-Node please share your workflow that we can see what is going on.
I believe the problem was me. When using an IF node, dragging a form field from several nodes back didnât work, but using the legacy version did, but only because the Condition I was dragging into was set to Fixed. The drag and drop works when the Condition is set to Expression. My mistake.
FWIW (if you would like the first impression of someone new to n8n) where the UI shows Fixed | Expression the selected item has a white background and the unselected item is gray. To me, thatâs nonintuitive. I know fx is also shown below when Expression is selected, but if you would like to make that choice as clear as possible, perhaps a simple on/off toggle button labeled Expression would be worth considering.
Great to hear that you found a solution. But sadly, I do not understand what was going on exactly. Every time a field gets dragged on a parameter it should get automatically changed to âExpressionâ as only like that, it can work and so would make sense. I also just tried in a small local example workflow. For me, it always sets the Parameter to âExpressionâ automatically.
I believe I used drag and drop in one node, and then created another version of that node and used copy-paste which doesnât toggle the expression mode. Thanks for your thoughtful replies.