# Unable to access data from previous nodes

**URL:** <https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677>\
**Category:** Questions\
**Tags:** node, workflow-building\
**Created:** [May 24, 2024, 7:10pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677 "2024-05-24T19:10:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmad\_Rajput](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_rajput/32/30544_2.png) [@Ahmad\_Rajput](https://community.n8n.io/u/Ahmad_Rajput)\
**Post date:** [May 24, 2024, 7:10pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/1 "2024-05-24T19:10:54Z")

</div>

## Unable to access data from previous nodes

(Posting first time so might make some errors in asking question. )

The issue seems that i cant access data even though it is present in the earlier nodes. I tried a bunch of stuff but nothing worked. originally i had a for loop node setup to go through many emails but now i am trying to fix it with atleast one then i can copy paste it 4 four times. Below are some screenshots that might help. The data can be accessed by $json notation by the immediately next node but not by a later node using $(‘Edit Fields’).item.json.

 ![Screenshot 2024-05-24 235831](https://europe1.discourse-cdn.com/n8n/original/3X/9/b/9b642de81096a1fc10beb96b6db80167d7ffb170.png)

 ![Screenshot 2024-05-24 235848](https://europe1.discourse-cdn.com/n8n/original/3X/4/f/4f4e77993bbf6bbb4c366915d1859dfd181e0519.png)

## Information on your n8n setup

- **n8n version: 1.42.1**
- **Database: SQLite**
- **n8n EXECUTIONS\_PROCESS setting: own**
- **Running n8n via: Docker**
- **Operating system: Linux Ubuntu**

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/196425_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [May 24, 2024, 7:10pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/2 "2024-05-24T19:10:55Z")

</div>

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [May 24, 2024, 8:24pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/3 "2024-05-24T20:24:16Z")

</div>

hello @Ahmad_Rajput

You can’t access the `item` property of the node, that has a different amount of outputted items.

In your case use the below syntax:

```auto
$('Edit Fields').last().json

```

---

<div class="post-metadata">

**Author:** ![Ahmad\_Rajput](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_rajput/32/30544_2.png) [@Ahmad\_Rajput](https://community.n8n.io/u/Ahmad_Rajput)\
**Post date:** [May 24, 2024, 8:49pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/4 "2024-05-24T20:49:39Z")

</div>

Thank you so much! Been stuck on it hours.

Quick question: why does .last() works? I see that for other case my loop works first time okay for a node data before loop but not after the first loop. Although I solved this issue using your .last() method but i am still curious. Here is the Screenshots:

 ![Screenshot 2024-05-25 014851](https://europe1.discourse-cdn.com/n8n/original/3X/b/a/bad2c024ea479133332907e4c4fd7fc2ee93dc73.png)  
 ![Screenshot 2024-05-25 014913](https://europe1.discourse-cdn.com/n8n/original/3X/f/7/f7ce800436c2935e9eadbc85e8cf9646830507c3.png)

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [May 25, 2024, 11:25am UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/5 "2024-05-25T11:25:05Z")

</div>

Because `last()` method will access the last item of the node no matter how many items it has and it doesn’t care of what is the current `$itemIndex`.

However, `item` property will work only if that item is linked to the previous nodes (basically, has the same `$itemIndex`). Usually, it does but there are some nodes that will change that behavior. The Loop node is one of those kind of nodes.

---

<div class="post-metadata">

**Author:** ![Ahmad\_Rajput](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ahmad_rajput/32/30544_2.png) [@Ahmad\_Rajput](https://community.n8n.io/u/Ahmad_Rajput)\
**Post date:** [May 25, 2024, 4:05pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/6 "2024-05-25T16:05:35Z")

</div>

Thank you!

---

<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:** [June 1, 2024, 4:06pm UTC](https://community.n8n.io/t/unable-to-access-data-from-previous-nodes/46677/7 "2024-06-01T16:06:24Z")

</div>

Closed on June 1, 2024, 4:06pm UTC

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