1

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 like DocumentId or CustomFilterId etc. – Arsalan Adam Khatri Jun 11 '14 at 7:11
  • Thanks for replying but the actual requirement is I will place this view in the ViewForm of Document library and the as per the item viewed from the document library the relevant tasks will be displayed. Is there better way other than this to achieve this? as per your view? – users1100 Jun 11 '14 at 7:15
  • I'm just guessing, can you try using some other variable for the QueryString parameter and check if it works.. – Arsalan Adam Khatri Jun 11 '14 at 7:18
  • You are right sir, but when the user will select particular document and will click on the View Property and the view property form has the query string parameter ID. That ID I want to use in the filter. As I will not be able to provide my custom query string parameter when the Display Form of document library will be opened. – users1100 Jun 11 '14 at 7:21
  • Can you please try the answer below – Arsalan Adam Khatri Jun 11 '14 at 7:23
1

The ID parameter name should be already in use, try following..

Replace

<ParameterBinding Name="ID" Location="QueryString(ID)" DefaultValue="0"/>

With

<ParameterBinding Name="DocumentId" Location="QueryString(ID)" DefaultValue="0"/>

And then simply replace

<FieldRef Name="Document" LookupId="TRUE"/> <Value Type="Lookup">{ID}</Value>

With

<FieldRef Name="Document" LookupId="TRUE"/> <Value Type="Lookup">{DocumentId}</Value>

  • I tried the way you suggested but not working. :-( – users1100 Jun 11 '14 at 7:27
  • Any ideas why it is not working? – users1100 Jun 11 '14 at 8:20
  • Nop I'm out of ideas, let someone else jump in.. – Arsalan Adam Khatri Jun 11 '14 at 8:30
0

Check is your changes are realy saved to view - reopen view in sharepoint designer. Will the task list be filtered if your hardcode document id value?

As workaround you can use webpart connection on the dispform.aspx of document library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.