Given the following structure
Home
Storage
Article1
Article2
Article3
Products
Product
Where the item product
has a Multilist with search
field that targets the item storage
. How do I set the StartSearchLocation relative to product?
I've tried the following
StartSearchLocation=query:[parent::item[@@templatename=Home]]/Storage
You can add the following to the Source
field of the template;
query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*
This will look for the ancestor (or iteself) that's template is Home, then looks for a child of home that has the is a template of storage. Then it will select all items underneath storage.
You can even go a step further and ensure it only selects items under storage that are articles;
query:ancestor-or-self:: *[@@templatename = 'home']/*[@@templatename = 'storage']/*[@@templatename = 'articles']
Although I wouldn't recommend using templatename
, rather Templateid
for example;
query:ancestor-or-self:: *[@@templateid = '{96563B8C-A000-488C-B7E2-96008C24F3D3}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']/*[@@templateid = '{0E47CA9D-E762-4FDF-8C6C-C500DD9EB40A}']
Don't forget to replace my Guids
with yours