How to filter a SharePoint list view by Hyperlink column in SharePoint online

Welcome to my blog readers. Today’s blog is on SharePoint and in today’s blog I will discuss a requirement which is quite common. But surprisingly there is hardly any solution to meet the requirement.

So much hype about the requirement. What it is? The requirement is to create/ filter a SharePoint List view by Hyperlink column?

If you are wondering why so much fuss about it, then let’s see the problem first.

I have a SharePoint List which have a Hyperlink column – “Report Link“. I want to create a view to show all items which does not have a report link value.

Filter SharePoint list view on Hyperlink column in SharePoint column

I am on the filter section of the view. Surprisingly you don’t see the Report Link column here. Basically Hyperlink columns does not show up in the filter columns.

If you search the internet, you will find solutions to this issue. But unfortunately all the solutions involve using the SharePoint designer. And SharePoint designer is from SharePoint server days (on-premise).

How to do it in SharePoint online? To accomplish this, I will use the SharePoint REST API’s. And to execute the REST API, I will use a Power Automate instant flow.

I created a Power Automate flow with Manual trigger. In the first action, I initialized a variable to set the view query we are looking for.

Filter SharePoint list view on Hyperlink column in SharePoint column

Below is the view filter

<Where>
	<IsNull>
		<FieldRef Name="ReportLink" />
	</IsNull>
</Where>

The view filter is in CAML query syntax. You can create views of any complexity here using the CAML schema. Click here to learn more.

The above CAML query is quite simple. I am using the IsNull filter. Also in the FieldRef, remember to specify the internal name of the field. Especially if you Field names contain spaces, the internal names of the columns will be different.

Now I have the view filter query? What’s the next step?

Quite obviously the next step is to invoke the REST API endpoint to create the view. To accomplish this, I use the “Send an HTTP request to SharePoint” action. Below is the action configuration.

Filter SharePoint list view on Hyperlink column in SharePoint column

Uri –> _api/web/lists/getByTitle(‘Sample List’)/views. Here sample list is the display name of my list. You will need to change it accordingly.

The most important section is the body. Below is the body content JSON.

{
  "__metadata": { "type": "SP.View" },
  "ViewType": "HTML",
  "Title": "Null condition Hyperlink",
  "PersonalView": false,
  "ViewQuery": "'@{variables('viewFilter')}'"
} 
Filter SharePoint list view on Hyperlink column in SharePoint column

Check the section highlighted in bold in the JSON sample above. That is the title of your view. You can change it as required.

All set and done. The next step is to execute the flow. Once the flow run successfully, I could see a new view created for my SharePoint list.

Filter SharePoint list view on Hyperlink column in SharePoint column

Below is the behavior. As you can see, the view filter is working just as expected. Awesome isn’t it?

You can obviously show/ hide columns in the view as per your requirement. All this is great but with all great things there is always a catch.

Never use the Edit view option from SharePoint interface if you wan to change the view filters for . Remember that Hyperlink column is not a supported filter on SharePoint interface.

Filter SharePoint list view on Hyperlink column in SharePoint column

If you edit and close the view, the null filter on the Hyperlink column will be removed.

If you are wondering if Power Automate flow is required for this, the answer is NO. You need some way to execute the REST API and for me, the quickest option was to create a Power Automate Instant flow.

Hope this helped. You will also like the below posts.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading