In this article, we will see how we can display list of items relevant to user based on his/her department.
Let say we have a list “Employees” which store employee details along with “Department” info.
Now we can create a different Site Page or a View and perform the steps there or we can simmly utilize the current “AllItems.aspx” page.
Lets edit the current page itself and add “Current User Filter” web part.
We need to set this filter first. From the web part menu, select “Edit Web Part”. On web part settings page, under “Filter” section, for “Select value to provide” select “SharePoint profile value for current user”. In this dropdown, select “Department”. Click ok.
We need to connect this filter to list web part to filter the results. From the web part menu, select “Connections” -> “Send Filter Values to” -> “Employees” list web part.
In the “Connection Type”, select “Get Filter Values From” and click “Configure”. On the configure connection screen, select “Consumer Field Name” as “Department”.
Click Finish. Stop editing the page. Navigate to this page fresh and see the results reflected.
This way we can configure any User Profile property to be used as filter.
Hope this helps.