2

I am using Sitecore 8.0 where I have created a template with field droplist field type and I want to give datasource for it where it references another template datasource. And we have Multiple Sites under the Sitecore Content node.

enter image description here

Below is what i need to acheive :

Have 2 templates FormFields template and the other one is Field type template. FormFields template has a field name "FieldType" with data type droplist which references the datasource which is been created using the Field type template.

We have multiple site nodes and same datasource of field types needs to be created in each site. For testing purpose i have the direct path of one of the site and for the field type it started showing the field types data in the form of dropdown. Same template i have to use it for other site nodes too so i am trying to write a query for datasource .

Tried below queries for field type, but both of them didn't work. :

1.DataSource=query:$site-root::/Site Content/Modules/CFieldTypes

2.query://*[@@id = '{59E50241-DBF5-4ED0-A3DA-852081022A5F}']

Here is the FormField template :

enter image description here

Here is datasource for Field types

enter image description here

As of now i have given the direct path to the datasource so it is looking like below scrnshot

enter image description here

Want to use same template for all the site nodes so i have tried different queries but didn't work.

Can anyone please suggest what I need to do?

Thank you

2
  • You need to specify in more detail what you need to achieve, and exaclty what "didn't work". Jan 12, 2022 at 13:05
  • Updated my question @MarkCassidy
    – Vinaya
    Jan 12, 2022 at 14:06

2 Answers 2

0

Droplist fields support Sitecore Query.

enter image description here

Have a look on this link and see how to build a Sitecore query:

https://doc.sitecore.com/xp/en/SdnArchive/Reference/Using%20Sitecore%20Query/Sitecore%20Query%20Syntax.html

For your second query it should work :

Attribute: [@@id]

Description: Item ID.

Query Example:

query://*[@@id = '{787EE6C5-0885-495D-855E-1D129C643E55}']

Searches through the entire content tree and returns an Item with the mentioned ID. 

Is not 100% clear what are you trying to achieve.

1
  • Can you please check have updated my question @Vlad lobagiu
    – Vinaya
    Jan 12, 2022 at 14:05
0

You can try below query

query:./ancestor-or-self::*[@@templatename='RootTemplate']/Data/DatasourceItem

I tried it on my instance with Droplist field and it's working.

3
  • Hi @Rishiraj , tried the above query by replacing my root template name but it didn't work
    – Vinaya
    Jan 12, 2022 at 14:13
  • did you set "/Data/DatasourceItem" as well, it denotes your datasource item location under website node. Jan 12, 2022 at 14:15
  • Yeah i have changed that one too
    – Vinaya
    Jan 12, 2022 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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