cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bpark1409
Level: Powered On

Unable to Patch Empty Fields in Collection created from a SharePoint List

Hi,

 

I have identified an issue with the Patch function - I wasn't sure if this is the correct forum to raise it with Microsoft, but I would be interested to know if anyone else has experienced the same problem and if there is somewhere else where I should be posting this to?

 

Summary

The issue is with using the Patch function to update an empty field in a Collection that was created from a SharePoint Online Custom list - The patch function is only able to update fields that were populated in the SharePoint list when the collection was created.

 

A workaround is to use the UpdateIf function.

 

Steps to reproduce the issues:

 

Create a SharePoint Custom List 'PatchTest' with the default 'Title' column and and additional single line of Text Column called 'TestCol'

 

List.pngList Definition

Create 2 items in the SharePoint list - One with the text column ('TestCol') populated and one with it left empty

 

 

List2.pngList Items

Create a blank PowerApp and Connect the SharePoint List as a Datasource

 

 

DataSource.png

 

Create a Collection in PowerApps using the SharePoint List

 

Put the following in the OnSelect Property of a button and use it to create the collection:

 

ClearCollect(colPatchTest,PatchTest)

Confirm the collection has been created:

 

Collection.png

 

Update the record with the Text Column ('TestCol') populated using Patch

 

Put the following in the OnSelect Property of a button and use it to update the first record:

 

Patch(colPatchTest,LookUp(colPatchTest,ID=1),{TestCol: "X"})

Confirm that the record has been updated:

 

Result1.png

 

Try to Update the record with the Text Column ('TestCol') empty using Patch

 

Put the following in the OnSelect Property of a button and use it to try to update the second record:

 

Patch(colPatchTest,LookUp(colPatchTest,ID=2),{TestCol: "X"})

 

Confirm that the record was NOT updated:

 

Result2.png

 

Workaround - Update the record with the Text Column ('TestCol') empty using UpdateIf

 

Put the following in the OnSelect Property of a button and use it to try to update the second record:

 

UpdateIf(colPatchTest,ID=2,{TestCol: "X"})

Confirm that the Record has been updated:

 

Result3.png

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Unable to Patch Empty Fields in Collection created from a SharePoint List

Hi @bpark1409 ,

It is an known issue with Patch function in PowerApps. The user @ChadVKealey has faced same issue with you, please check the response within the following thread:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Patch-Problem-Existing-data-updated-new...

 

As an alternative solution, please consider take a try to update your record using UpdateIf function instead of Patch function. Please modify your formula as below:

 

UpdateIf(
colPatchTest,
ID = 2,
{
TestCol: "X"
}
)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Unable to Patch Empty Fields in Collection created from a SharePoint List

@bpark1409 

This is an issue using the Patch function.  Use the UpdateIf function instead.

Take a look at this posting for some more information.

 

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Unable to Patch Empty Fields in Collection created from a SharePoint List

Hi @bpark1409 ,

It is an known issue with Patch function in PowerApps. The user @ChadVKealey has faced same issue with you, please check the response within the following thread:

https://powerusers.microsoft.com/t5/Expressions-and-Formulas/Patch-Problem-Existing-data-updated-new...

 

As an alternative solution, please consider take a try to update your record using UpdateIf function instead of Patch function. Please modify your formula as below:

 

UpdateIf(
colPatchTest,
ID = 2,
{
TestCol: "X"
}
)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BrianPark
Level: Powered On

Re: Unable to Patch Empty Fields in Collection created from a SharePoint List

Hi @v-xida-msft,

 

Thanks for confirming that this is a known issue.

 

FYI - I included the use of UpdateIf as a workaround within my  original post.

 

Regards.

nzblue_fish
Level: Powered On

Re: Unable to Patch Empty Fields in Collection created from a SharePoint List

I've just spent a few hours diagnosing this problem and finally concluding it must be a bug in the Patch function.  A quick search confirmed my hunch. So thanks to all for posting both the issue and solution.

 

Hmmm ... Some 4 months on since this was raised and this is still a production bug! Smiley Sad

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

Top Kudoed Authors
Users Online
Currently online: 49 members 4,913 guests
Please welcome our newest community members: