I have a Droplink field and I am trying to set the data source in the templates. What I want to do is set the data source by id instead of path and also add a filter by templates

For example query:/sitecore/content/sites/home/content/products/*[@@templateid='{4B8840D7-C56C-440F-B97E-973B6860B206}']
This Works. But, I don't want to give the path of "products" but it's item id because the path can change later.

So i tried


and this works. but not sure how to add template filter.

i tried

datasource={B343ACC6-591C-4E67-8538-D73D87FEE998}/*[@@templateid = '{4B8840D7-C56C-440F-B97E-973B6860B206}']
and other different combinations. Doesn't work.


I would add the Template Filter on the Datasource almost in the same way you are doing But I would put the ID, on the Standard values(not on the data source on the template) or on the item itself, I believe this would solve your issue

To learn more about how to Restrict the item by template I would recommend the following link https://stackoverflow.com/questions/24952880/sitecore-restrict-item-by-data-template-type-on-a-field


The DropLink does not support a "Parameterized Datasource" where you could use parameters like Datasource and IncludeTemplatesForDisplay. But with using the query syntax, it should be possible.

You could try it like this:

query://*[@@id = '{B343ACC6-591C-4E67-8538-D73D87FEE998}']/*[@@templateid='{4B8840D7-C56C-440F-B97E-973B6860B206}']

as query://*[@@id = '{...}'] searches through the entire content tree and returns an Item with the mentioned ID.

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.