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 Selected Gallery...
Power Apps
Answered

Patch Selected Gallery Item

(1) ShareShare
ReportReport
Posted on by 10
Hello,
 
I have a gallery that is displaying a sharepoint list.  I'm trying to make updates to the list values for the selected gallery item.
 
So, what I've done is switched out the default labels with text input fields.  The default property for these fields are set to ThisItem.'Field Name' so they display the proper values from the list.
 
For example, my gallery is called gal_HistoryGallery with the Items property set Filter('MyListName', 'Requested By Email'=varUserEmail) so it'll only display entries based on my email.  The gallery is displaying the proper data.  In the gallery, I have a text input called txtInp_FirstandLastName and the default property is set to ThisItem.'First and Last Name'.
 
I edit the value in the txtInp_FirstandLastName and click a button with a OnSelect function of Patch(gal_HistoryGallery.Selected, {'First and Last Name':txtInp_FirstandLastName.text}).  But the value in the list doesn't get updated.
 
This is my first time attempting to make edits to a list directly from the gallery itself.  I'm probably way of base on how I'm trying to perform this update.  Any help is appreciated.
 
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,417 Most Valuable Professional on at
    If you are running this from inside the gallery (as it appears you are)
    Patch(
       MyListName,
       {
          ID: ThisItem.ID,
          'First and Last Name': txtInp_FirstandLastName.Text
       }
    )
     
    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    LinkedIn    Buy me a coffee
  • CU31122130-0 Profile Picture
    10 on at
     
    I tried your suggestion, and it does work.  Thank you!
    Patch(
       MyListName,
       {
          ID: ThisItem.ID,
          'First and Last Name': txtInp_FirstandLastName.Text
       }
    )
    I tried to take this and apply it to multiple fields at once using the following:
    Patch(
       MyListName
       {
          ID: ThisItem.ID,
          'First and Last Name': txtInp_FirstandLastName.Text
       },
       {
          ID: ThisItem.ID,
          'Partner Name': txtInp_PartnerName.Text
       },
       {
          ID: ThisItem.ID,
          'Email Address': txtInp_EmailAddress.Text
       }
    )
     
    This partially works.  It'll update the last two fields but for some reason it won't update the 'First and Last Name'.
     
    I also tried the following:
    Patch(
       MyListName,
       {
          ID: ThisItem.ID,
          'First and Last Name': txtInp_FirstandLastName.Text
       };
    )
    Patch(
       {
          ID: ThisItem.ID,
          'Partner Name': txtInp_PartnerName.Text
       };
    )
    Patch(
       {
          ID: ThisItem.ID,
          'Email Address': txtInp_EmailAddress.Text
       }
    )
     
    This also partially works but instead of updating only the last two fields it only updates the first two and won't update 'Email Address'.
     
    Any suggestions?
  • WarrenBelz Profile Picture
    156,417 Most Valuable Professional on at
    Firstly for multiple fields, it should be this
    Patch(
       MyListName,
       {
          ID: ThisItem.ID,
          'First and Last Name': txtInp_FirstandLastName.Text,
          'Partner Name': txtInp_PartnerName.Text,
          'Email Address': txtInp_EmailAddress.Text
       }
    )
    and will work providing the ID of the relevant record is available in the gallery  - the Items of 
    Filter(
       'MyListName', 
       'Requested By Email' = varUserEmail
    )
    suggests it would be available and that those three Text Inputs are in the gallery (which they appear to be from your screenshot).
     
    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    LinkedIn    Buy me a coffee
     
  • Suggested answer
    Trait007 Profile Picture
    310 on at
    Hi,
    • If you have multiple fields you want to update, you can add them inside the {} object:
      Patch(
      'MyListName',
      gal_HistoryGallery.Selected,
      {
      'First and Last Name': txtInp_FirstandLastName.Text,
      'Another Field': txtInp_AnotherField.Text
      }
      );
    • To handle any possible errors, you can use the IfError() function to show messages if the update fails:
      IfError(
      Patch(
      'MyListName',
      gal_HistoryGallery.Selected,
      { 'First and Last Name': txtInp_FirstandLastName.Text }
      ),
      Notify("Error updating the list", NotificationType.Error)
      );
    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!
  • Verified answer
    WarrenBelz Profile Picture
    156,417 Most Valuable Professional on at
    NOTE: Gallery.Selected has at times some inconsistencies - you need to be specific - either as I posted
    Patch(
       MyListName,
       {
          ID: ThisItem.ID,
          'First and Last Name': txtInp_FirstandLastName.Text,
          'Partner Name': txtInp_PartnerName.Text,
          'Email Address': txtInp_EmailAddress.Text
       }
    )
    or the "longer" way
    Patch(
       MyListName,
       LookUp(
          MyListName,
          ID = ThisItem.ID
       ),
       {
          'First and Last Name': txtInp_FirstandLastName.Text,
          'Partner Name': txtInp_PartnerName.Text,
          'Email Address': txtInp_EmailAddress.Text
       }
    )
     
  • CU31122130-0 Profile Picture
    10 on at
    Thank you @WarrenBelz and @VASANTH KUMAR BALMADI for your help.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard