Creating multiple items from function

I’m taking a tab delimited document it and parsing through it to give me an output to then update salesforce with. I’m running into an issue where my parsing of the text says that it’s only 1 output item.
I’ve pinned the data and pasted the nodes below so I hope they show up correctly. But from this point I need to go through each object and make a request using the Salesforce node.

this is the output of the Function node if it doesn’t pass the pinned data

[
  [
    {
      "recordId": "0033C00000Ys2b7QAB",
      "outboundTrackingNumber": "kdfjlkjadflkjasfdk",
      "documentSent": "2022-09-14T00:00:00+00:00",
      "documentInHome": "2022-09-16T00:00:00+00:00",
      "inboundTrackingNumber": "joijoijoijoijoijoij",
      "inboundFirstScan": "2022-09-17T00:00:00+00:00",
      "inboundDocumentScanUploaded": "2022-02-27T00:00:00+00:00"
    },
    {
      "recordId": "0033C00000ZIjEEQA1",
      "outboundTrackingNumber": "1651651dfdsfdsf",
      "documentSent": "2022-09-14T00:00:00+00:00",
      "documentInHome": "2022-09-16T00:00:00+00:00",
      "inboundTrackingNumber": "adfdfasdfwwe",
      "inboundFirstScan": "2022-09-17T00:00:00+00:00",
      "inboundDocumentScanUploaded": "2022-02-27T00:00:00+00:00"
    }
  ]
]

Figured this out. One thing I noticed was I though I was working with in function instead of function item. But the key here I found if any one has an issue. The second array of object, n8n sees that second array as one item.

Rebuilding the output JSON to look like this is seen as multiple items

 [
  {
    "recordId": "0033C00000Ys2b7QAB",
    "outboundTrackingNumber": "kdfjlkjadflkjasfdk",
    "documentSent": "2022-09-14T00:00:00+00:00",
    "documentInHome": "2022-09-16T00:00:00+00:00",
    "inboundTrackingNumber": "joijoijoijoijoijoij",
    "inboundFirstScan": "2022-09-17T00:00:00+00:00",
    "inboundDocumentScanUploaded": "2022-02-27T00:00:00+00:00"
  },
  {
    "recordId": "0033C00000ZIjEEQA1",
    "outboundTrackingNumber": "1651651dfdsfdsf",
    "documentSent": "2022-09-14T00:00:00+00:00",
    "documentInHome": "2022-09-16T00:00:00+00:00",
    "inboundTrackingNumber": "adfdfasdfwwe",
    "inboundFirstScan": "2022-09-17T00:00:00+00:00",
    "inboundDocumentScanUploaded": "2022-02-27T00:00:00+00:00"
  }
]
1 Like

Hey @Philip_Wiggins,

Did you manage to sort this one out or is there still an issue?

yes thanks!

1 Like