Hi folks,
Does anyone know if there’s a reliable way to access the item I’m currently looping over?
Here’s the workflow I’m working with:
At the very end of the workflow, I update a record in a spreadsheet. To do that, I need to access the row_number from the current item. However, I haven’t been able to find a simple and reliable way to do this.
Currently, I’m using the following workaround:
I store $input.item.json as a field in the “Format Data” node output:
let record = $input.item.json;
let thread = record.Body;
return {
date: record.Date,
subject: record.Subject,
sender: extractEmail(record.From),
thread: thread,
item: $input.item
};
Then, in the “Update Record” node, I use this expression:
{{ $(‘Format data’).first().json.item.json.row_number }}
While this works, it feels fragile and easy to break.
I suspect the workflow would work better without the loop, but if I remove it, I’m unsure how to reliably get the row_number to update the spreadsheet.
Surely, there must be a straightforward way to access the item from previous nodes leading to the current step, right?
Any insights or suggestions would be much appreciated!