1

I have the following sites and lists:-

  1. Department list inside my site collection root site.
  2. Module List inside a sub-site.
  3. Each Module item is linked with a department item through a lookup field.
  4. Now i define an event receiver inside my Module list, which will fire when a module item is added. the event receiver will create a new module sub-site. where the new Module sub-site URL will be equal to the module Item ID.
  5. now inside the new Module sub-site there is a list named "Tracking" which have a custom content type named "CustomTracking".

now i am trying to define the following:-

  1. When a user click on a Department item inside the Department List.
  2. To show all the "Tracking" items from the Module sub-sites, which is related to the current department.

Now i have started with the following:-

  1. Inside the Department list's Display form (DispForm.aspx).
  2. I Edit the Page.
  3. I Add a content search web-part.
  4. Inside the content search web-part, I define to retrieve all the Tracking items that have the "CustomTracking" content type.
  5. So in this way I am able to retrieve all the Tracking items inside the department items display forms.

Now the only pending point i have, is that how i can define to only show the Tracking items which are:-

  1. Under a Module sub-site.
  2. and this Module sub-site have its URL equal to a Module item.
  3. and this Module item is under the current Department (current department mean the department item's display form).

Here is a drawing to describe my situation :-

enter image description here

so can anyone adivce if i can modify the display template of the content search web-part (where this web-part will be rendered inside the Department items Display Form), to only show the tracking items which are under a module sub-site and this module sub-site have its url equal to a module item ID which is under the current department item??

  • 2
  • @M.Qassas Thanks for your links I am already ware of this. now my scenario is as follow:- when users click on a certain Department item, they will be redirected to the display form. and the department ID will be inside the URL DispForm.aspx?ID=16. so i can using REST API to query all the Modules items which have DeptID (lookup column) =16. so in this way i will have the info about what are the module ids inside the Deptid=16.. This is part ONE. – john Gu Dec 19 '16 at 13:38
  • @M.Qassas Part TWO then i can inside my display template to check all my "Tracking" items, and only show the Tracking items which are inside a sub-site that have its url = to any of the related module IDs... so in this way when a user click on the department item , he can only view the Tracking items which are define inside the related module subsites .. now this will work on paper but i am not sure how i can achieve this inside my display template? – john Gu Dec 19 '16 at 13:39
  • How many tracking ids will be there for one module/department? Are you planning to use paging and refiners of CSWP? If not this seems to be complex thing to be done with CSWP and you might have to switch to JSOM/REST with keyword query for search – Unnie Dec 25 '16 at 11:25

Your Answer

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

Browse other questions tagged or ask your own question.