0

I have a SharePoint list form (customized with PowerApps) in which I have a requirement for multiple attachment fields on one form. Basically my form has an Intake section, and 2 Approval sections - each section should have its own Attachments control. I realize that we can only have One Attachments field per SharePoint list. So what I did was create two additional Lists, and added their Edit Forms (not Visible) to my main Screen. I then cut and pasted the Datacardvalue (Attachments control) inside of two custom data cards, then told my Submit button to submit those forms too. This actually works to an extent. If I add a different attachment to each of the 3 fields, then return to the Submitted form, each attachments field populates ALL attachments, rather than the specific one I added to that specific section.

So, I think I need to add some kind of Filter function to the Attachment fields, but I'm not sure what that would be. I need Field 1's attachment to display only that attachment, Field 2 to only display its own attachment, and Field 3 to display its own attachment.

What would be the best way to go about this?

Thanks!

1 Answer 1

0

This actually works to an extent. If I add a different attachment to each of the 3 fields, then return to the Submitted form, each attachments field populates ALL attachments, rather than the specific one I added to that specific section.

The reason for this is that Forms can only have one data source. So even though you have copied the attachments control from a different form, it is still only going to apply to the data source of your main form. The reason it doesn't actually break is because they all have an "Attachments" field. You've pretty much just duplicated the attachments control from your original form.

I'm sure there are several ways to achieve your goal, but this would be the way I would look to implement something like this:

  1. Create a document library to hold your attachments
  2. Add a Number column to the attachments document library and call it something like ParentID
  3. Add a Choice column to the attachments document library and call it something like Category. Choices along the lines of "Intake" "Approval 1" and "Approval 2"
  4. Add 3 galleries to a custom data card on your form
  5. Data sources for your galleries would be something like:

Filter(attachmentsLibrary, ParentID = ThisItem.ID && Category.Value = "Intake")

Filter(attachmentsLibrary, ParentID = ThisItem.ID && Category.Value = "Approval 1")

Filter(attachmentsLibrary, ParentID = ThisItem.ID && Category.Value = "Approval 2")

That's probably the easy part. You would then need to add an attachments control for each category and create a Flow that uploads attachments to the document library and sets the ParentID field to the ID of the list item.

Shane Young has some great tutorials on YouTube on how to do this:

  1. Power Apps Upload File v2 to SharePoint Document Library

  2. Power Apps Copy, Edit, and Save Parent Child Data - Expense Report Example

  3. PowerApps Repeating Tables like InfoPath Part 1 - Enter the data

  4. PowerApps Repeating Tables like InfoPath Part 2 - View and edit the data

1
  • Thanks! I'll give this a try. Alternatively, is there a way I can display specific attachments? Users will only attach one file per section - so can I set the default value of my attachment fields to = the item's 1st, 2nd, 3rd attachments that were submitted? Like, I attach Document1 in Field 1, then Document2 in Field 2 - I know they're being added to the same item, so can I set Field 2 to then display Document2 when the Form is in Edit Mode?
    – Chris
    Apr 8 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.