How to clear fields in SharePoint list items using Power Automate

Yesterday on LinkedIn I was asked about how to clear fields using Power Automate, by Matthew Bourne working at Heathrow.

Creating list items

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

Creating a SharePoint list item with Flow

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.

Updating SharePoint list items with a flow

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

Update items having required fields

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

Setting the Title to the existing Title value

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.

List items in SharePoint

Clear fields

How do we now set values to blank?

Clearing fields in SharePoint

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.

Choice field has been cleared

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

Setting all fields to null

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

Now my flow fails to run

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.

Note: in the above example MERGE is case sensitive.

Clear Managed Metadata fields

And then you want to clear the value of a managed Metadata field…. Well, using the null value isn’t going to work.

To clear a managed metadata field you will need to use the following expression:

concat('')

Yes, that is how easy it can be. Just set it to an empty string and the managed metadata field will be cleared.

Wouldn’t it be nice if the way to clear fields was the same for all types of fields?

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


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

Leave a Reply

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