cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sebgedge
Helper I
Helper I

Updating Records with Patch

Hi,

 

I'm trying to update specific records in the app I've added the following formula to the OnSelect property of the save button but this isn't working.  The requested operation is invalid Server Response: A value but be provided for item. im a trying to filter on the GUID which isn't displayed in the Selected Gallery.

Patch(Table1,First(Filter(Table1, GUID = Gallery2.Selected.GUID)),{Title: DataCardValue6}),{First_x0020_Name:DataCardValue4},{Last_x0020_Name: DataCardValue5},{Age: DataCardValue2},{Email:DataCardValue3},{Address:DataCardValue1},{MobileNo:

 

I also need to set two additional fields when the save button is clicked which is a modified on and by these are hidden on the form but utilising the UpdateContact({ModifiedOn: Now()}) doesn't set the form field or write back to the data source as expected.

 

Seb

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @sebgedge ,

 

There is something wrong with your formulas. You should use 'Title: DataCardValue6.Text ' to call the value you enter. The same goes for the other fields. '{field: value, field2: value2}' represents one record with two fields, so you have these field in one set of braces.

If you also want to save the 'ModifiedOn' field, you can put it into the formula directly. So the formula should be modified as below:

 

Patch(Table1,First(Filter(Table1, GUID = Gallery2.Selected.GUID)),{Title: DataCardValue6.Text, First_x0020_Name:DataCardValue4.Text, Last_x0020_Name: DataCardValue5.Text , Age: DataCardValue2.Text, Email:DataCardValue3.Text, Address:DataCardValue1.Text, ModifiedOn: Now()})

 

Best regards,
Sik

View solution in original post

2 REPLIES 2
v-siky-msft
Community Support
Community Support

Hi @sebgedge ,

 

There is something wrong with your formulas. You should use 'Title: DataCardValue6.Text ' to call the value you enter. The same goes for the other fields. '{field: value, field2: value2}' represents one record with two fields, so you have these field in one set of braces.

If you also want to save the 'ModifiedOn' field, you can put it into the formula directly. So the formula should be modified as below:

 

Patch(Table1,First(Filter(Table1, GUID = Gallery2.Selected.GUID)),{Title: DataCardValue6.Text, First_x0020_Name:DataCardValue4.Text, Last_x0020_Name: DataCardValue5.Text , Age: DataCardValue2.Text, Email:DataCardValue3.Text, Address:DataCardValue1.Text, ModifiedOn: Now()})

 

Best regards,
Sik

Thanks for the help 🙂 worked perfectly 

 

Seb

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,943)