Design view filter using SharePoint Designer
Applies to: SharePoint Online and On-Premises
Description: It is difficult to configure grouping (Multiple AND & OR) in SharePoint list view filter conditions using SharePoint view settings UI. Also, SharePoint supports maximum of 10 columns to filter in the view. In order to overcome this limitation, the view filter query (CAML Query) can be modified using the SharePoint Designer as per the requirement.
In this example, we are replacing the CAML query such that “Tasks” list view shows the items where “Assigned To” is either logged in user or the groups where the logged in user is a member.
– Run SharePoint designer as Administrator, Open the site.
– Provide Site URL in the “Site Name” text box (highlighted area in below screenshot) and open
– Click Lists and Libraries in the navigation pane
– Click on the desired list under “Lists” and it will pull all the list information
– Click on the desired view from available views. If designer does not allow to modify the content, click on advanced mode as shown below.
– Open Source view mode by selecting Code as shown below
– Now Add/replace existing Where clause in CAML Query part of the view with the desired CAML query.
CAML Query for our example case:
<FieldRef ID="AssignedTo" />
<FieldRef Name="AssignedTo" />
The above query is to show the list items where logged in user is in Assigned To column or logged in user is a member of the group entered in the Assigned To column.
For more information about CAML queries and CAML Query Builder tool, refer: https://msdn.microsoft.com/en-us/library/ff647340.aspx