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

Patch Function Error - Gallery vs Form? (screenshots attached)

(0) ShareShare
ReportReport
Posted on by 19

I have a data table saved in dataverse. On one screen, User1 submits a form, creating a new record in that dataverse.

 

On a second screen, User 2 can view all of the records in a Gallery. If User 2 wishes, User 2 can click to  iew the details of that record and will be brought to a different screen. The details of that record are shown via a form (not a Gallery). I want to use the Patch tool so User 2 can update a field (only one field) if needed, but am getting an error with my Patch tool. Any thoughts? Thank you in advance (very new to this)!

 

 

Pic 1Pic 1Pic 2Pic 2

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    In your patch code. Try Gallery.Selected.ID or whatever the unique id column is

  • shane13519 Profile Picture
    19 on at

    I think I now have the correct formula:

     

    Patch('Rule 3526 Communications Requests', Gallery2_2.Selected, {'Results (text)': DataCardValue7})

     

    But I am now getting this error, any thoughts?

    3.jpg

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @shane13519 

    You don't need to use the patch function.  Just open an edit form from the gallery using the same DataSource in both the gallery and the form and the Item as Lookup(DataSource, ID=Gallery1.Selected.ID).  Make sure that when you click on the icon in the gallery, that it includes the EditForm(Form1), where Form1 is the name of the edit form.   A button with SubmitForm(Form1) on the same screen as the form will submit the changes. 

  • shane13519 Profile Picture
    19 on at

    @Drrickryp Apologies. Could you please elaborate a little more? What you're saying sounds much easier than what I am trying to do, but I am not sure how to do it. If it helps, I tried to re-explain what I am trying to to (I am currently using a Gallery and an editable form already, so I may already be doing some of what you suggested?) THANK YOU!

     

    4.jpg

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @shane13519 

    Sure, In the ">" icon, that navigates to your edit form screen - View Request Details_1 include EditForm(Form1_2) so the OnSelect property of the icon should be 

    EditForm(Form1_2); Navigate('View Report Details_1')

    The Datasource of the form should be 'Rule 3526 Communications Requests'

    The Item property of the form should be 

    Lookup('Rule 3526 Communications Requests', ID= Gallery2_2.Selected.ID)

    The Save button should be SubmitForm(Form1_2)

    You could put Back() in the OnSuccess Property of the form to return to the gallery screen to show that the changes were saved.  You can then get rid of the Back button and the Edit button. 

     

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @shane13519 

    Sure, In the ">" icon, that navigates to your edit form screen - View Request Details_1 include EditForm(Form1_2) so the OnSelect property of the icon should be 

     

    EditForm(Form1_2); Navigate('View Report Details_1')

     

    The Datasource of the form should be 'Rule 3526 Communications Requests'

    The Item property of the form should be 

     

    Lookup('Rule 3526 Communications Requests', ID= Gallery2_2.Selected.ID)

     

    The Save button should be SubmitForm(Form1_2)

    You could put Back() in the OnSuccess Property of the form to return to the gallery screen to show that the changes were saved.  You can then get rid of the Back button and the Edit button. 

     

    BTW you can use the same screen for entering a New record by putting an Icon outside the gallery and making its OnSelect property:

     

    NewForm(Form1_2); Navigate('View Report Details_1')

     

    The Item property will be ignored when you use this icon since the record has not been created until the data is submitted.  All of the cards will contain the Default values for the controls in them when the form is in New mode.

     

    Forms have many built in properties that are lost when you use a Patch() instead of submitting a form.  

     

  • shane13519 Profile Picture
    19 on at

    THANK YOU!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard