Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Patch function for attachments to Sharepoint List

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)
))
 
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Patch function for attachments to Sharepoint List
    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)
  • WOT1119 Profile Picture
    WOT1119 6 on at
    Patch function for attachments to Sharepoint List
    @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
    WarrenBelz 143,487 on at
    Patch function for attachments to Sharepoint List
    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
    WOT1119 6 on at
    Patch function for attachments to Sharepoint List
    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:
  • abc 123 Profile Picture
    abc 123 629 on at
    Patch function for attachments to Sharepoint List
    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.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard