I have two lists one is tasks list and the other is document library.
In Tasks list I have created one lookup
column of the document library i.e. document is shown with tasks.
I have created view using UI of Tasks list which filters the tasks by the document id provided in the Query string parameter. To do so, I edited the view in the SharePoint designer.
My xml for view is as below which appears in the SPDesigner:
<ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>
<ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/>
<ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
<ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
<ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" />
<ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" />
<ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" />
<ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" /> <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(core,noXinviewofY_DEFAULT)" />
<ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
<ParameterBinding Name="MoreAnnouncements" Location="Resource(wss,moreItemsParen)" />
<ParameterBinding Name="ID" Location="QueryString(ID)" DefaultValue="0"/>
</ParameterBindings>
<View Name="{05EFB3E3-3F47-4782-A2A2-55B5E05483CB}" MobileView="TRUE" Type="HTML" DisplayName="DocumentView" Url="/sites/pub-3105/Lists/Tasks/DocumentView.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/issuelst.png?rev=23" >
<Query>
<Where>
<Eq>
<FieldRef Name="Document" LookupId="TRUE"/>
<Value Type="Lookup">{ID}</Value>
</Eq>
</Where></Query>
<ViewFields>
<FieldRef Name="Checkmark"/>
<FieldRef Name="LinkTitle"/>
<FieldRef Name="DueDate"/>
<FieldRef Name="AssignedTo"/>
<FieldRef Name="Document"/>
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off"/><JSLink>hierarchytaskslist.js</JSLink>
<XslLink Default="TRUE">main.xsl</XslLink><Toolbar Type="Standard"/>
</View>
But when I go to the view in the task list and provide the parameter like : [url]?ID=1 I am not getting the items filtered by the document id, though there are 2 items in the list which has given the lookup value to the same document id in the query string parameter.
The filtered view is going to be placed in the ViewForm of document library to display the relevant tasks of the document.
What am I missing?
ID
might be an internal parameter name, try using some other name for the parameter likeDocumentId
orCustomFilterId
etc.