cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kart-19
Level: Powered On

Patching one record makes other previously updated record disappear.

Hello All,

 

I am facing a strange situation while patching multiple records to a single line. 

 

I have a Sharepoint list 'List1' that is connected directly to my powerapps(No collection is created at start). i also have a couple of non editable fields(inside the form) and 5 editable fields outside the form namely Comment1(dropdown), comment2,comment3,comment4(all are text inputs) and follow up date(datepicker). The task is the user updates all these editable fields while working on the record and saves them in the list directly via powerapps.

 

The problem i am facing is when i update one record say comment 1, it successfully patches to the matched column in sharepoint list , but when i go again and update comment 2, it clears the comment1 record from the SP list and updates comment2 in its matching field and comment1 previously updated clears. When i try to update comment1-comment5 alltogether the patch works perfect and updates the SP list with all the required comments. Please note that i am not creating a new SP record for every update of the comment but all the comments are being updated against the record already present. I tried the coding presented in one of the forums here. I have also created one ID column named as ID1 and i am not using the default ID column.

 

These are my fields editable

app.jpgThis is my editable

 

this is my code....

Set(myItem,LookUp(Data1,ID1=Value(DataCardValue2.Text)));If(IsBlank(myItem),
Patch(Data1{ID1:Value(DataCardValue2.Text),comment1:Comment1Dropdown.Selected.Value,comment2:Comment2Text.Text,comment3:Comment3Text.Text,FOLLOWUP_DATE:FollowDatePicker.SelectedDate,comment4:Comment4Text.Text}),

Patch(Data1,myItem{ID1:Value(DataCardValue2.Text),comment1:Comment1Dropdown.Selected.Value,comment2:Comment2Text.Text,comment3:Comment3Text.Text,FOLLOWUP_DATE:FollowDatePicker.SelectedDate,comment4:Comment4Text.Text});Navigate(Initial,ScreenTransition.Fade))

 

1 REPLY 1
Super User
Super User

Re: Patching one record makes other previously updated record disappear.

Hi @Kart-19 

Please review the information in the documentation on the Patch() function https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch  Each patch function consists of three elements

  • the datasource being patched
  • the record being patched
  • the columns in the record that are being edited

in the example of a record being edited,  the Lookup() identifies which record is being edited.

Patch( Customers, Lookup( Customers, Name = "Contoso" ) , { Phone: “1-212-555-1234” } )

 In the example of a new record being added, Defaults() tells PowerApps that you are adding a New record to the Customers table.  

Patch( Customers, Defaults( Customer ), { Name: “Contoso” } )

Please review your app to make sure you follow the proper syntax for the Patch() function.

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 123 members 4,800 guests
Please welcome our newest community members: