PowerApps

Have you ever been struggling with a lack of the possibility to clear a number, person or lookup column using PowerApps? Well, I recently found myself in a situation, where I needed to be able to clear such columns in my application, but found out, that this is not possible (maybe not yet).

I was trying every approach I could think of – setting blank values, using empty object for lookup:

{
  '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
  Id: 0,
  Value: null
}

and peoplepicker but none of them worked. When I thought this is impossible I reminded myself about the tight integration between PowerApps and Microsoft Flow.

The solution

Using Flow triggered by clicking a button (or by other action) it turned out to be very easy. Simply – go to the “actions” tab (1), select Flow (2). Select the button you want to bind with the Flow (3). Next click to create a new one (4). After that create a single action: “Call HTTP endpoint in SharePoint”. Then select the created Flow (5) and pass arguments to it (6):

Prepare Flow for button click in PowerApps

Simple "PowerApps button" Flow

Why? I found out, that using the regular “Update item” action does not allow to clear lookup and person fields as well (uh!), moreover there is no action to update a single field in a record (again, not yet), so first you would need to query that list item, get its data and rewrite it to the update action, so that it won’t wipe out all other fields as well. A lot of work, as you need to update a single field.

The configuration of the “Call HTTP endpoint in SharePoint” action is as below (note, this is a new action in Flow and is extremely useful, as you don’t need to use HTTP request action, grant it OAuth permissions or make a trust in SharePoint. Simple and easy):

Send an HTTP Request to SharePoint

Then you can add the “Return to PowerApps” action, so that you can make a sequence of events in PowerApps or return some information back to your application.

It really works like a charm!

PowerApps and Flow clearing fields in SharePoint