How to Have Multiple Attachments in Power Apps?

First, we need to create a simple form as shown below using the SharePoint list, which has the following columns - Full Name, attachments inbuild column.

Fields

Next, we need to add two attachments “datacard” by navigating to the field property of the form shown in the below screen.

Add two attachments

By Clicking on fields, we can add multiple “datacards” on the form.

Add multiple “datacards”

Now, basically, if we submit the form what will happen is all the “datafields” inside the “datacards” get submitted into the list. But you will see only one attachment will get submitted.

Attachment Submitted

Testing

To Resolve this issue, we will get all the attachments from the attachments controls, and we need to remove the “datafields” from both attachments as shown in the below screens.

Attachment Control

Testing

Next, we need to add another form inside the screen connect the same “datasource” as the previous form and add one more attachment control.

we need to set collection to the needed attachment control. Later, we need to hide this form from the screen.

Form

Tree view

Then simply submit the main form, which is form1. then we need to patch the 2nd form and update the function into the same record by using "Form1.LastSubmit.ID".

ClearCollect(addAttachments, Table());
Collect(addAttachments, DataCardValue8.Attachments, DataCardValue9.Attachments);
SubmitForm(Form1);
Patch(
    EmployeeList,
    LookUp(EmployeeList, ID = Form1.LastSubmit.ID),
    Form2.Updates
);
ResetForm(Form1);
ResetForm(Form2);
ClearCollect(addAttachments, Table());

Code submit

Now if we submit the form, we will see all the attachments from both the controls are there inside the list and before the form gets reset, you need to turn on the visibility of the 2nd form. You will see something like the below screen.

Employee

This Data is finally submitted list.

Submitted list


Similar Articles