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 / Patch function for att...
Power Apps
Unanswered

Patch function for attachments to Sharepoint List

(0) ShareShare
ReportReport
Posted on by 6
Good morning, the function returns all results needed but it's on 4 different lines in the Sharepoint List when I was hoping for 3 lines:
  1. attachment
  2. line 1 of gallery
  3. line 2 of gallery
(line 1 and 2 depend on how many rows submitted inside the gallery)
 
I have too many patch stmts below. Will someone please help me clean this up? Would be greatly appreciated!
 
//Patch the Info and the Choice and get the list ID
Set(TempCol, Patch ('New PO Request - MC ST OKC', Defaults('New PO Request - MC ST OKC'),
        {
        Title:txt_Vendor.Text
        }));
 
//Update with patch function and the attachments and the choices
Patch('New PO Request - MC ST OKC', LookUp('New PO Request - MC ST OKC',ID=TempCol.ID);
{
},fmAttachment.Updates);
 
ForAll(
    gal_OrderItems.AllItems,
    Patch(
        'New PO Request - MC ST OKC',
        Defaults('New PO Request - MC ST OKC'),
        {
            Title:txt_Vendor.Text,
            'Reason for purchase': txt_Purchase.Text,
            Items:txt_Item.Text,
            'Charged back?': tgl_CB.Value,
            'DT/Customer Name': txt_Customer.Text,
             Office:ddOffice.SelectedText,
             Qty: txt_Qty.Text,
            'Item Cost': txt_Price.Text,
            Description:txt_Desc.Text
        }
);
 
Notify("Data successfully submitted to Sharepoint",NotificationType.Success,4000);
 
Concurrent(
ResetForm(fmAttachment),
Reset(gal_OrderItems)
))
 
Categories:
I have the same question (0)
  • abc 123 Profile Picture
    789 Moderator on at
    In the ForAll(), your Patch uses Defaults, which adds new rows. If you don't want new rows, than change that to the Lookup, like above it.
  • WOT1119 Profile Picture
    6 on at
    The only issue with the above Sharepoint list is that it's not including the attachment on the same line as an item & that the first row only contains the vendor info:
  • WarrenBelz Profile Picture
    154,447 Most Valuable Professional on at
    If you want three rows with the attachments on each one - I also have a query with the Office field - is that a Table or Text field ?
    Patch(
       'New PO Request - MC ST OKC',
       ForAll(
          gal_OrderItems.AllItems As _Items,
          {
             Title: _Items.txt_Vendor.Text,
             'Reason for purchase': _Items.txt_Purchase.Text,
             Items: _Items.txt_Item.Text,
             'Charged back?': _Items.tgl_CB.Value,
             'DT/Customer Name': _Items.txt_Customer.Text,
             Office: _Items.ddOffice.Selected.Value
             Qty: _Items.txt_Qty.Text,
             'Item Cost': _Items.txt_Price.Text,
             Description:_Items.txt_Desc.Text
          },
          fmAttachment.Updates
       )
    );
    Notify(
       "Data successfully submitted to Sharepoint",
       NotificationType.Success,
       4000
    );
    Concurrent(
       ResetForm(fmAttachment),
       Reset(gal_OrderItems)
    )
     
    Please click 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 giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WOT1119 Profile Picture
    6 on at
    @WarrenBelz, I am unable to reply to your msg below. I appreciate you helping me with this. The formula you posted did not work because I did not explain well enough. I need to pull in the following:
     
    Screen 1 (office is a drop down list)
     
     
    Under Gallery,
     
     
    I would greatly appreciate if you would guide me please
  • WarrenBelz Profile Picture
    154,447 Most Valuable Professional on at
    I am not getting notifications presently, so finding responses is difficult. If you are collecting fields from the Form, do not put _Items. in front of the reference (only for those in the gallery)

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard