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

Clear SharePoint field data

I would like to clear field/column value on click of a button for a particular item. I have a SharePoint Person type field (AssignedTo). I have tried using Patch and Blank function but it is not clearing the value. Currently, the AssignedTo value is set to a single user. 

 

Patch(Bookings, First(Filter(TaskList, BrowseGallery1.Selected.ID = ID)),{
AssignedTo:Blank()
}
)

 

I have tried ClearCollection function and UpdateContext({ReservedBy:""}) but that didn't work as well.

12 REPLIES 12
Adi2ro
Level: Powered On

Re: Clear SharePoint field data

I have the same issue. Can't clear that field using PowerApps.If you find something, please let me know. Smiley Happy

DXiong
Level: Powered On

Re: Clear SharePoint field data

Hello Guys,

 

From my understanding, it looks like you would like to set a sharepoint field to blank, or null.

 

Here's what I did:

Set the input box to a variable(varFieldReset), then use OnSelect/OnChange to UpdateContext({varFieldReset:Blank()})

 

When you patch your field, it'll change it to Blank()

 

Let me know if that worked for you

Adi2ro
Level: Powered On

Re: Clear SharePoint field data

I would try it, however we are dealing with a lookup of type "People" so now sure where to change that without getting an error. I guess one of the main problems is using this Lookup, since you can't customize it too much and still have expectations to work properly.

 

For example I have a column of type People and in my Edit Form, by default I want it to bring the default value, which is set. Now if I want to bring other values for selection, I don't know how to change that and keep the setting ok (since the lookup column has multiple field when it comes to it's source).

 

So if I just delete and submit form, it actually never deletes. Even worse... I have other fields taking value from there, for example a couple of Single Line of Texts, that takes FullName and Email from the person you are selecting. If I delete the selection, the fields appear blank, but when submiting the form, they actually don't submit a blank in the single line of text since the Lookup field, never actually get's a blank to submit.

DXiong
Level: Powered On

Re: Clear SharePoint field data

Well, in order for you to get a blank one, what I did was create a blank item in Sharepoint list. Leaving this one blank would allow you to select blank as an option. Please use this only if a blank entry doesn't effect your data.

 

Now, for the other issue, you will have to set the default as a variable (PersonFullNameVariable and PersonEmailVariable).

 

Now for the Lookup dropdown box, use the "If" statement in the OnChange box to UpdateContext of the variable.

If(PersonLookup.Selected.Value=Blank(), UpdateContext({PersonFullNameVariable:Blank(),PersonEmailVariable:Blank()}),UpdateContext({PersonFullNameVariableSmiley TongueersonLookup.DisplayName,PersonEmailVariableSmiley TongueersonLookup.Email})

This way you what changes will be according to the variable. You'll also need to patch those changes to those columns as well otherwise, your changes will be done for nothing.

 

Hope this helps!

Adi2ro
Level: Powered On

Re: Clear SharePoint field data

One last question:

 

Does this apply to lookup fields not dropdown? As my field is not a dropdown, is a people finder.

DavidV
Level: Powered On

Re: Clear SharePoint field data

Looks like the reply is not respecting threaded conversation Smiley Happy.  Thanks for your reply but UpdateContext ({AssignedTo:Blank()}) doesn't clear out the value of a People picker field. 

DavidV
Level: Powered On

Re: Clear SharePoint field data

I am still not able to figure this out. Is it not supported at all ? Can I please get an official response in that case?

DennisO
Level: Powered On

Re: Clear SharePoint field data

What is the "Input" box?  None of the fields in Advanced menu have that title.

Eric_C
Level: Power Up

Re: Clear SharePoint field data

Just ran into this problem and appear to have a working solution. Reading through a different post for Flow they were able to reset the field by using a -1. Try:
Patch(Source, Record, { Column: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id:-1, Value:""} })

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

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: 299 members 4,353 guests
Please welcome our newest community members: