Unable to reference data from previous node

Describe the problem/error/question

I have an issue with a single workflow using the HTTP node. I’m able to get a response, but that response data cannot be referenced in any other nodes after the HTTP node. I’ve tried to use the Set node, the Code node, and execute workflow node to see if I can reference this data somehow and it still isn’t referenceable

What is the error message (if any)?

Please share your workflow

Here’s the json data returned from the HTTP Node:

[
  {
    "id": 586,
    "display_name": "John Doe",
    "actual_name": "",
    "short_name": "JD",
    "icon": "",
    "team_id": 0,
    "is_agent": false,
    "is_closed": false,
    "is_assigned": true,
    "livechat_started": true,
    "last_message_id": 8,
    "last_update_date": "2023-08-11T15:06:58.2",
    "participant_count": 2,
    "ticket_id": 0,
    "participant_id": 2,
    "participant_read_id": 8,
    "participant_lastnotification_id": 8,
    "unread_count": 0,
    "unnotified_count": 0,
    "other_participant": {
      "id": 1,
      "chat_id": 1586,
      "agent_id": 0,
      "user_id": 0,
      "hasleftchat": false,
      "anon_connection_id": "noconnection",
      "read_id": 8,
      "lastnotification_id": 8,
      "lcos_id": 41,
      "name": "John Doe",
      "email": "[email protected]",
      "short_name": "JS",
      "onlinestatus": -1,
      "lastonline": "Last online 45148 days ago",
      "teams_conversation_id": ""
    },
    "flow_step": -9999,
    "teams_activity": "",
    "teams_conversation_id": ""
  }
]

Here’s the HTTP and code node I’m using to reference the data (I’ve used a Set node as well to no avail)

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Here’s what is returned from the Code node:

[
  {
    "id": 0
  }
]

Here’s what is expected to return from the Code node with this sample data (the variables are the same, but the first one checks if the value exists and makes the value 0 if it doesn’t:

[
  {
    "id": 586,
    "checkid": 586
  }
]

Information on your n8n setup

  • n8n version: 0.225.2
  • Database (default: SQLite): MySQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu 22

Hi @jhambach

w/ the Set node you can directly access the values from object before:

If your HTTP Request returns more than one item, you’ll get the corresponding items.
keepOnlySet=true will ignore all other values from the node before.

  • Kurt

I appreciate the response, but doing the same within the set node doesn’t work either and I use the set node often. There is just a single item output from the HTTP node

Sorry, took me some time:

Only change in your Code node version:

id = $node["Fake HTTP Request"].json.id || 0;
checkid = $node["Fake HTTP Request"].json.id;

vs

id = $node["Halo Check For Chats"].json["id"] || 0;
checkid = $node["Halo Check For Chats"].json["id"] ;

Hope that helps.

  • Kurt
2 Likes

Your reply gave me an idea, so in the set node after my http request node I set a string to be the entire response of the http request. It’s not perfect but it works :person_shrugging:

1 Like

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