I am working on a content search web-part inside my SharePoint Enterprise server 2013.
Now i have the following general overview of my current sites and lists which i am trying to query inside my web part:-
- Inside the Root site i have a list named Dept . SiteURL=http://servername/
- Inside another sub-site I have a list named Module which have a lookup field (DeptID) referencing the Dept list. SiteURL=http://servername/Modules/
- Now for each module item (inside the Module list) we have a sub-site representing this module item. the sub-site url will contain the module item ID, as follow;http://servername/Modules/1 (representing module item id 1),http://servername/Modules/2 , etc..
- Inside each Module sub-site we have a Tracking list.
Now i have added a Content Search WebPart inside my Dept list display form; To show all the Tracking items which are related to the current Dept Item (the dept item which is being rendered inside the display form).
So inside the content search web-part i am trying to do the following:-
- By default, when users click on a certain Department item, they will be redirected to its display form. and the department ID will be inside the URL such as `DispForm.aspx?ID=16`..
- Now using the REST API i can query all the Modules items inside the Module List, which have thier DeptID (lookup column) = the current DeptID (for example 16).
- So in this way i will have a list of all the module items' IDs which are related to the current Dept.
- Then i can inside my content search web part's display template (which will mainly show all the tracking items from all the module sub-sites) to specify to only show the Tracking items which are inside a sub-site and this sub-site have its url = one of the related module IDs...
Now i am not sure how i can achieve these four steps inside my display templates?
Thanks