In this post, we will discuss how to work with the Current User Filter in SharePoint 2013 Online. We will use the Current User Filter web part with a list view web part. In this particular example, I have a sample list which has two columns one is Title and CreatedByFirstName. Here we will filter the records based on logged in user’s first name.
SharePoint has inbuilt filter criteria presented with [Me] which will work with People picker field type, like Created by [Me] or Modified by [Me]. But this will be helpful in other cases where you will not have a people picker, maybe a single line text and you want to filter on other user profile properties like the first name, last name, department etc.
Here is our list.
Now let us say I am logged in with Bijay Sahoo and here I want to filter records based on First Name. So If I open it should show records where the filter criteria “CreatedByFirstName” is Bijay.
So for this, I have created a sample web part page. In that page First I add the list view web part (MyTest List).
For this Edit the page -> Add web part than from Categories select “Apps” and then select MyTest list from the list of apps, then click on Add. Once you will Save the page it will display all the records.
Now again Edit the page and click on Add a Web Part. Then From the Categories Filters -> then add “Current User Filter” web part as shown in the fig below:
Then select the web part and then click on Edit Web part as shown in the fig below:
Then in the Current User Filter web part properties, you can see like below. It will display Current username in the format of i:firstname.lastname@example.org.
But here our requirement is to filter based on the First Name. So I need logging in user’s first name. So for this select the second radio button “SharePoint profile value for current user”. Now in this dropdown, it will show what are the properties (user profile properties) are available.
From there select the Last Name as shown in the fig below. You can select as per requirement like department, last name, username, work email etc. Then click on OK.
Then edit the web part again. click on Connections -> Send Filter Values To -> Then select the list [Here it is MyTest]. Here make sure pop up is enabled here.
Then it will display the Choose connection popup. Here in the Connection Type select “Get Filter Values From” and then click on Configure as shown in the fig below:
Then in the next screen (tab). By default the “Provider Field Name Current User” will come. In the Consumer Field Name select the list column name which you want to filter. Like here I want to filter based on CreatedByFirstName column from the column’s dropdown as shown like below:
Then click on Finish. And Stop editing and Save the page.
Now if you will refresh the page, you will be able to see the items created by logged in users the first name as shown in the fig below:
Hope this will be helpful.
You May Also like the Following SharePoint Tutorials: