Advertisements
Update Item with HTTP request

Microsoft Flow – How to clear fields in SharePoint list items

Yesterday on LinkedIn I was asked about how to clear a people field using Microsoft Flow, by Matthew Bourne working at Heathrow.

These kind of things can be a real challenge. When you update a list item an empty value simply means ignore this field. To go through the issues here I will start by creating a flow that creates an item in a SharePoint list.

Creating list items

Updating List Items

When I run this flow an item will be created and I can use the ID of this item to update my list item.

Managing required fields

The first pain is already visible. The Title field is a required field and I can’t save my flow. I can create a view without the Title field however that will still not help me. The required Title field still appears in the update item action

To work around this issue I’m going to set the Title to the title of the created item

Looking at the item created in SharePoint I’ve now got the described result. Even though I left fields blank the updated item will have the values set as specified in my create an item action.

Clearing fields

How do we now set values to blank?

With Choice fields and many other field types I can simply set the value to null and as shown below the Choice field is cleared.

Having built up my confidence I’m just going to set all fields to null. Easy Job done! …

… or maybe not. When I ran the above flow I found that the update item action now failed.

Looking at the detail of the failing action, I got an error on the user field:

The specified user could not be found
This is not nice. But help is near. Using the HTTP request I can clear the people field by setting the StringId to an empty string and the Id to -1.
Update Item with HTTP request
So now it is up to you to either update all fields using the HTTP request action or to just use this for people fields. Both option are perfectly valid.

Other related posts

Microsoft Flow – Update a List item with a people field using REST API in the Send an HTTP request to SharePoint action

SharePoint / Microsoft Flow – User guide to using the SharePoint REST API in Microsoft Flow for no-code developers

Advertisements

One thought on “Microsoft Flow – How to clear fields in SharePoint list items

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: