I’m having a similar issue to this post, but I can’t find a solution: Using values from previous nodes - cant get data for expression - #5 by Petero
When dragging an input from a node 3 steps back into a field I’m getting “invalid expression”.
Normally in the above I pass the binary to text node to a crypto node to generate a signature hash for authentication, but I removed it just to make it a little more straightforward.
After the Onboard/Offboard switch, I’m calling Jira to make sure no tickets with the same name exists in the system. If the response is empty, I continue the flow. For the last Jira shape, I need to use values from one of the earlier nodes, since no data is passed from the node directly before it. So, I’m attempting to grab data from the Onboard/Offboard Switch after dragging and dropping {{ $('Onboard/Offboard Switch').item.json.fields['First Name'] }}
, which returns “invalid expression”.
I have a code node, but it’s only being used to reconstruct the JSON object from the raw body I get from a webhook (which I need to construct the crypto signature). In the following step I’m using a Split Out node, so I feel like adding pairedItem
to the code doesn’t really make sense? I’ve tried adding in and I still can’t drag and drop effectively.
Using the legacy syntax works (i.e. {{ $node['Onboard/Offboard Switch'].json.fields['First Name'] }}
), but it only picks up the first item (which makes sense). The webhook can send multiple items which are broken out by the split out node, so I would like to be able to hit the last Jira node with as many times the split node generates.
I placed a manual data insertion node to insert a payload after the split node just to text to see if I could drag and drop in the final Jira Node by bypassing the code node, but I’m having the same issue. Would love to know what I’m doing wrong!
If an example payload is needed, here’s the webhook input data:
{
"employees": [
{
"changedFields": [
"Status"
],
"fields": {
"First Name": "test1first",
"Last Name": "test1last",
"Department": "Sales",
"Status": "Inactive",
"Hire Date": "2022-05-24",
"Termination Date": "2024-01-17",
"Work Email": "[email protected]",
"Home Email": null
},
"id": "156"
},
{
"changedFields": [
"Status"
],
"fields": {
"First Name": "test2first",
"Last Name": "test2last",
"Department": "Sales",
"Status": "Inactive",
"Hire Date": "2023-05-08",
"Termination Date": "2024-01-12",
"Work Email": "[email protected]",
"Home Email": "[email protected]"
},
"id": "243"
},
{
"changedFields": [
"Status"
],
"fields": {
"First Name": "test3first",
"Last Name": "test3last",
"Department": "HR/Talent",
"Status": "Inactive",
"Hire Date": "2023-12-11",
"Termination Date": null,
"Work Email": "[email protected]",
"Home Email": "[email protected]"
},
"id": "279"
}
]
}
And here’s what can be inserted into the manual data node:
[
{
"changedFields": [
"Status"
],
"fields": {
"First Name": "test_first",
"Last Name": "test_last",
"Department": "Sales",
"Status": "Inactive",
"Hire Date": "2021-11-16",
"Termination Date": "2024-01-31",
"Work Email": "[email protected]",
"Home Email": null,
"Country": null
},
"id": "136"
},
{
"changedFields": [
"Status"
],
"fields": {
"First Name": "test2_first",
"Last Name": "test2_last",
"Department": "Exec & Admin",
"Status": "Inactive",
"Hire Date": "2023-02-01",
"Termination Date": "2024-01-31",
"Work Email": "[email protected]",
"Home Email": "[email protected]",
"Country": "United States"
},
"id": "223"
}
]
Information on your n8n setup
- n8n version: 1.25.1
- Database (default: SQLite): default
- n8n EXECUTIONS_PROCESS setting (default: own, main): default
- Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
- Operating system: cloud