This doc shows users how to handle and attach files uploaded to Multiple Documents in Webform to any record in SFDC.

By default, if you create an attached Form Request (‘Source Record Id’ record in Form Request is Id of any other object), all uploaded files are attached to this record with ‘Source Record Id’.If you created an unattached Form Request (‘Source Record Id’ record is Form Request Id), all uploaded files are attached to the current Form Request.
But after this update, users can attach these files to any record/s using a brief Flow configuration.
- To handle Multiple Attachments in Flow after submitting Webform
In Flow Builder, just:
- Create a New Variable.
- Name it exactly: multipleAttachmentsMetadata
- Set:
- Data Type: Apex-Defined
- Apex Class: cadmus_form__AttachmentMetadata
- Allow multiple values (collection): true
- Available for Input: true

2. Now users get all uploaded file in the Flow in a list with the following parameters in multipleAttachmentsMetadata variable:

3. So, with a simple path example in Flow below, the user can link uploaded files to any record:

- Check if multipleAttachments exist:

- If the list is not empty, get the record to attach the docs, in this example, it’s the Account from our unattached Webform (last created Account):

- Then loop through every added document in the flow:

- For each document, set variable values:
- {!varNewCDL.ContentDocumentId} Equals {!Docs_for_Reparent.contentDocumentId}
- {!varNewCDL.LinkedEntityId} Equals {!Last_inserted_Acc.Id}
- {!varNewCDL.ShareType} Equals Viewer
- {!varNewCDL.Visibility} Equals AllUsers
- {!varNewDocumentsCollection} ADD {!varNewCDL}

- In this example, we created additional variables:
- o varNewCDL – to store new data for every single document:

-
- varNewDocumentsCollection – to store a list with all docs to insert:

-
- After the assignment, insert these documents into the appropriate record:

