web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Submit one Attachment ...
Power Apps
Answered

Submit one Attachment to Patch to multiple records on a Sharepoint List

(0) ShareShare
ReportReport
Posted on by 17
Good afternoon!
 
I have a list called ShipDetail that was patched at a first moment without the attachments. 

At another screen on the app, I have a gallery with items for the ShipDetail list being displayed.
I am creating a collection on select for every item that's selected on the gallery as
 
Collect(
    colConfPickUp, ThisItem
  )
 
How can I add an attachment (one pdf only, always) that will apply to every record on the collection and patch it to a different list BOLShipping? So on BOLShipping every record will have an attachment to it?
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,930 Most Valuable Professional on at
    Normally, you cannot patch attachments outside a Form, but there is a hack/workaround that will work with one attachment and did so here when tested with your model. Firstly, I assume you have an attachment control that the user uploads the file to. The first thing you need to to is to add an Image control (you can hide it) with the Image
    First(AttachmentControlName.Attachments).Value
    Now this should Patch the first attachment to all records in the Collection (using your Attachment and Image Control names)
    ForAll(
       colConfPickUp As _Items,
       Patch(
          ShipDetail,
          {
             ID: _Items.ID,
             Attachments: Table(
                {
                   DisplayName: First(AttachmentControlName.Attachments).Name,
                   AbsoluteUri: Blank(),
                   Id: ImageName.Image,
                   Value: ImageName.Image
                }
             )
          }
       )
    )
     
    You can also do it with a Flow, and I will go there if the above does not work for you.
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Verified answer
    VO-16022037-0 Profile Picture
    17 on at


    @WarrenBelz, 
     
    Good morning!
     
    I've tried this way you said by:
     
    ForAll(
       colConfPickUp As _Items,
       Patch(
          BOLShipping,
          {
             MaterialDoc: _Items.MaterialDoc,
             Batch:  _Items.Batch,
             Status: "Performing Test",
             Attachments: Table(
                {
                   DisplayName: First(DataCardValue8.Attachments).Name,
                   AbsoluteUri: Blank(),
                   Id: Image2.Image,
                   Value: Image2.Image
                }
             )
          }
       )
    )
    But I get an error that says:
     
    "Field 'Id' is required."

    I also saw in another post here you mentioned about creating a new gallery, to read off of the collection. I added an image in the gallery with:
    First(ThisItem.Attachments).Value
     
    And my patch as:
     
     
    Patch(
       BOLShipping,
       ForAll(
          Gallery2.AllItems As _Data,
          {
       
             MaterialDoc: _Data.MaterialDoc,
             Batch:  _Data.BatchL,
             Status: "Performing Test",
             Attachments: Table(
                {
                   DisplayName: _Data.AttachName.Text,
                   AbsoluteUri: Blank(),
                   Id:  _Data.Image1.Image,
                   Value: _Data.Image1.Image
                }
             )
          }
       )
    )
     
    but I also get the same error, "Field 'Id' is required."
     
    Any thoughts?
     
  • WarrenBelz Profile Picture
    154,930 Most Valuable Professional on at
    Yes it is a hack that I suspect was never intended in the Power Apps design. As I noted, it works here on a test list but I can understand you may have to go the Power Automate route. 
     
    So going back to your collection- your Flow would look like this
     
     
    and the run code like this
     
    ForAll(
       colConfPickUp As _Items,
       YourFlowName.Run(
          _Items.MaterialDoc,
          _Items.BatchL,
          _Items."Performing Test",
          {
             file: {
                contentBytes: First(DataCardValue8.Attachments).Value,
                name: First(DataCardValue8.Attachments).Name
             }
          }
       )
    )
     
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard