Premise
We had this requirement where we needed to create ~100 (parent/child)
QuickLaunch links pointing to a single modern SharePoint list. These links will be filtered view on the same list based on the selection. We knew, that in modern SharePoint, instead of creating 100 different views, we can simply filter a list using specified query string parameters. The issue in hand were, how to:
- Generate the URLs on Managed Metadata (Termstore) field for QuickLaunch
- Automate the QuickLaunch creation process
Solution
Before proceeding further, let me state that the complete working script is available on GitHub.
As mentioned above, in modern SharePoint, we can directly filter a list view from URL, query string. A custom filter URL, for a TermStore field will look like the following:
/{ListURL}?
useFiltersInViewXml=1&
FilterField1={NameOfTheField}&
FilterValue1={WssId}&
FilterType1=Counter&
FilterLookupId1=1&
FilterOp1=In
These are the required parameters:
Parameters | Usage | IsDynamic |
ListURL | List/{Library serverRelativeURL} | Yes |
useFiltersInViewXml | Signifies allowing of filtering | No |
FilterField1 | Internal name of the field | Yes |
FilterValue1 | WssId of the Term | Yes |
FilterType1 | Type of the filter. For managed metadata field, its Counter | No |
FilterLookupId1 | Order of the filter. 1 is for first filter with this and then, any other value, if applicable | No |
FilterOp1 | Not sure. Maybe the In acronym refers inner join | No |
For ex, a typical example will look like the following:
/teams/{SiteName}/Published/Forms/AllItems.aspx?useFiltersInViewXml=1&FilterField1=Process&FilterValue1=28&FilterType1=Counter&FilterLookupId1=1&FilterOp1=In
Generate Filter URL: Managed Metadata
Generating this URL is slightly tricky.
Managed Metadata field is filtered using its unique, WssId value.
WssId is a unique integer number, assigned to each Term. The issue with WssId is that it’s not available by default. Initially, all the Terms have the same WssId, 0! So applying a filter on them will never fetch any result.
WssId is automatically generated whenever a Term value is used for the very first time
A term’s WssId is generated once the value has been used. So, to solve this problem of having no WssId, I had to modify my Navigation automation script. Instead of directly reading the WssId value from the Term, I started updating a particular list item with the given Term value first. After that, I’ll read the same Term to fetch its WssId. This will always ensure that the Term, for which I’ll be generating the Navigation, has a unique WssId pre-assigned.
So, the whole process is divided into the following steps;
- Read the list of Terms from a config file (CSV)
- Apply it on a dummy list item to automatically generate its WssId
- Get the Term
- Use this WssId to create the URL
- Create a QuickLaunch navigation link using the above URL

Automate the QuickLaunch creation process
Now, that the issues are all addressed, let’s discuss the script. The script accepts 2 config files:
- NavigationList.csv
- CreateFilterUrlInNavigationConfig.psd1
NavigationList.csv
This file contains the name of the Terms along with their menu hierarchy, to be maintained in the site. First column is the header QuickLaunch link. The second column is the child. To represent a parent child relation, repeat the header values for each child element, as demonstrated in the file.
CreateFilterUrlInNavigationConfig.psd1
This file contains the following configuration parameters required for this script to execute;
Parameters | Description |
siteUrl | Full URL of the target site |
userName | The email id of the user required to run the script. Ensure this user has access on the global managed metadata service |
listName | The name of the list whose items will be updated in order to generate the WssId |
csvFilePath | Local file path where the NavigationList.csv is file is kept |
skipUpdateList | Not implemented yet. Idea is to skip the update process for terms already possessing unique WssId |
grpName | Term group name |
listItemId | The temp list item whose values will be updated to generate the WssIds |
serverRelativeUrl | The serverRelativeUrl of the list/library for which the menu links have to be generated. Plz ensure that our dummy listitem also resides here, only |
Fields | This is a collection of configurations to create the mapping of TermSets with list fields. For ex, my TermSet name is, ‘Mega Process’ however, the field, it’s mapped to has an internal name, ‘Process’. The script will fetch the Terms using their original names but, will apply to the field’s internal name using this mapping |
Running the Script
Following is the list of managed metadata that I want to use in Quicklaunch. The same has been used in the config Excel file.

Once we execute the script, it will create our Navigation links in the menu maintaining the parent-child hierarchy.

Clicking on an item, say Logistique, will filter the source list with the selected value.

If you notice, you will find a number 7 out there. This 7 is the unique WssId assigned to our filter. This number might be different in other sites. Hence, we need to ensure that it is already generated for a term before using the same.
Key Takeaways
- Once again, the entire solution is available on this GitHub link.
- If your CSV is multi-lingual (anything other than English) then, you might receive Encoding errors. To solve that, kindly refer this link.
- This script should be executed using the account of a global admin only.
Nice work… This was very helpful for me…
LikeLike
This looks really promising. Thank you for sharing, Piyush K Singh!
LikeLike
Hi Piyush K Singh,
Thanks
Can you help me how to filter share point modern web page to modern List view web part using custom filter.
LikeLike
I would like to know the same as above, please: “Can you help me how to filter share point modern web page to modern List view web part using custom filter.”
Thanks!
LikeLike
Well we know what FilterOp1-10 is – ‘Eq’ or ‘Neq’ or ‘Lt’ or ‘Gt’ or ‘Leq’ or ‘Geq’. However they don’t seem to be implemented/working in SharePoint online. So how do we filter for a date range, used to be able to do this in On Prem versions …
LikeLike