cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shane13519
Frequent Visitor

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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

@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.  

 

View solution in original post

7 REPLIES 7
zmansuri
Super User
Super User

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

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
Super User
Super User

@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
Frequent Visitor

@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
Super User
Super User

@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. 

 

Drrickryp
Super User
Super User

@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.  

 

View solution in original post

THANK YOU!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,410)