cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

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 DefinitionList Definition

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

 

 

List ItemsList 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
Highlighted
Community Support
Community Support

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.

View solution in original post

5 REPLIES 5
Highlighted
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.
Highlighted
Community Support
Community Support

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.

View solution in original post

Highlighted
Regular Visitor

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.

Highlighted
Frequent Visitor

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! 😞

Highlighted
Power Apps
Power Apps

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

We believe we have fixed this issue with version 3.20051.16, available with the Frequent cadence in some regions such as Canada.  It will be rolling out to everyone soon.  Please give it a try and let us know if you still see an issue.

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,659)