# Node cannot access data from previous node v1.11.2+

**URL:** <https://community.n8n.io/t/node-cannot-access-data-from-previous-node-v1-11-2/32679>\
**Category:** Questions\
**Tags:** expressions\
**Created:** [November 9, 2023, 5:49pm UTC](https://community.n8n.io/t/node-cannot-access-data-from-previous-node-v1-11-2/32679 "2023-11-09T17:49:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saal](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@saal](https://community.n8n.io/u/saal)\
**Post date:** [November 9, 2023, 5:49pm UTC](https://community.n8n.io/t/node-cannot-access-data-from-previous-node-v1-11-2/32679/1 "2023-11-09T17:49:53Z")

</div>

## Describe the problem/error/question

Posting this here in follow up to: [Unable to access content of a previous node from anything other than the immediate next node · Issue #7623 · n8n-io/n8n · GitHub](https://github.com/n8n-io/n8n/issues/7623#issuecomment-1802907648)

When processing batch items, the IF node throws the following error:

ERROR: Invalid expression under ‘Conditions \> String’  
The expression uses data in the node ‘ **Salesforce** ’ but there is more than one matching item in that node

Video: [https://photos.app.goo.gl/FiwSjYqDdYNKQG439](https://photos.app.goo.gl/FiwSjYqDdYNKQG439)

## What is the error message (if any)?

## Please share your workflow

## Share the output returned by the last node

Please check the video and then use the data below for the last two nodes

Salesforce  
query

```auto
SELECT Id, Legacy_ID__c FROM Contact 
WHERE planet_CRM_Address_Processed __c = false AND Legacy_ID__ c != null
LIMIT 2

```

```auto
[
  {
    "attributes": {
      "type": "Contact",
      "url": "/services/data/v39.0/sobjects/Contact/0031v00003JcdMAAAZ"
    },
    "Id": "0031v00003JcdMAAAZ",
    "Legacy_ID__c": "169193"
  },
  {
    "attributes": {
      "type": "Contact",
      "url": "/services/data/v39.0/sobjects/Contact/0031v00003JcdMBAAZ"
    },
    "Id": "0031v00003JcdMBAAZ",
    "Legacy_ID__c": "169195"
  }
]

```

for MySQL node:

```auto
query:
SELECT 
       l.party_id,
       l.type,
       l.id
FROM locator l
         INNER JOIN party p on l.party_id = p.id
WHERE l.category = 'address'
  AND l.party_id = '{{ $('Salesforce1').item.json.Legacy_ID__c }}'
  AND l.is_default = 1
  AND l.real_locator_id IS NULL
  AND l.deleted_at IS NULL;

```

```auto
[
  {
    "party_id": 169193,
    "type": "default",
    "id": 338058
  },
  {
    "party_id": 169195,
    "type": "default",
    "id": 890332
  }
]

```

## Information on your n8n setup

- **n8n version:** 1.15.2
- **Database (default: SQLite):** Postgres
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):** queue
- **Running n8n via (Docker, npm, n8n cloud, desktop app):** heroku
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [November 14, 2023, 1:46pm UTC](https://community.n8n.io/t/node-cannot-access-data-from-previous-node-v1-11-2/32679/3 "2023-11-14T13:46:09Z")

</div>

Hi @saal, I am sorry you’re having trouble. As suggested by Jon over on GitHub this is because you’re trying to access a [linked item](https://docs.n8n.io/data/data-mapping/data-item-linking/item-linking-concepts/) (formerly known as paired item) after running a custom query on your MySQL1 node.

n8n will not be able to produce a linked item for custom SQL queries since it won’t be able to analyze which result was generated by which input item here.

You could avoid this problem for example by using a legacy expression type like `{{ $node['Salesforce1'].json.Legacy_ID__c }}`

In this case n8n just assumes the first item on the current node corresponds to the first item of the `Salesforce1` node. The second item on the current node corresponds to the second item of `Salesforce1` etc.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [February 12, 2024, 1:46pm UTC](https://community.n8n.io/t/node-cannot-access-data-from-previous-node-v1-11-2/32679/4 "2024-02-12T13:46:18Z")

</div>

Closed on February 12, 2024, 1:46pm UTC

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