Issue with uploading multiple file to Salesforce

The problem I’m having is according to the nodes, all 3 documents were successfully uploaded, but when I go to the uploaded record it only shows the First document in the Salesforce record. I believe what happens is when the node goes through to upload the other two documents, it’s not setting the LinkedEntityId to the Salesforce record. So all three get uploaded, but only the first links to the record.

Do I need to do something different in having all three documents upload to the same record?

Output:

|id|success|errors|
| --- | --- | --- |
|06805000001mHnJAAU|true|[]|
|06805000001mHnOAAU|true|[]|
|06805000001mHnTAAU|true|[]|

Hi @Philip_Wiggins,
welcome to the community :tada:

I suspect it has something to do with your Salesforce expression

{{$node["Retrieved from MailParser"].json["body"]["record_id"]}}

It seems your webhook receives 1 item containing multiple urls. When you upload your first file it will use item(0) from $node["Retrieved from MailParser"], that works. If you upload you second file it trys to use item(1), which does not exist. Instead try to always use item(0) like this:

{{item(0).$node["Retrieved from MailParser"].json["body"]["record_id"]}}

An alternative would be returning the record_id alongside your urls in your Function Node like this:

urlList.push({ url, record_id: items[0].json.body.record_id})

You should then be able to do this:

{{$node["Get ALL URLs"].json["record_id"]}}
1 Like