Having The Source Field be the Link Provided in Another Sitecore Item - sitecore

Suppose Item A contains the link Item B would like to use as the source of its Droplist field. How can I achieve this? I have read the Sitecore Query documentation here and here. It appears to me that this is not achievable using Sitecore query, but I could be mistaken. Any help would be appreciated.

No this is not possible. To set the source of a droplist, you can either set the root path to an item which would make the droplist populate the sub-items or you can use Sitecore query to query for specific items based on your query. This is covered in the Data Definition Cookbook (PDF link) under 2.4.2.

Related

sitecore 7 multi datasource field

I have a treelist field that I want to set the datasource to 3 folders p.e.:
/sitecore/Website/News/
/sitecore/Website/Events/
/sitecore/Website/Articles/
Under the website item there are more "folders".
I've searched and spent few hours trying different approaches but none seemed to work.
Is this possible? Do I need to extend the field?
Thank you in advance
A while back I wrote a blog post about the different ways you can control the Datasource of your multilist and treelist fields (with and without search). The third technique listed for fields with search is what I think you are looking for:
Search in two or more places of the content tree (Fields with Search):
StartSearchLocation={110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}&Filter=_path:110d559fdea542ea9c1c8a5df7e70ef9|_path:3d6658d8a0bf4e75b3e2d050fabcf4e1
For your implementation:
StartSearchLocation={Website.ID}&Filter=_path:[News.ID (guid form; no brackets)]|_path:[Events.ID (guid form; no brackets)]|_path:[Articles.ID (guid form; no brackets)]
Search in two or more places of the content tree (Fields without Search):
If you are using a Multilist field (without search) then I would do the following:
DataSource=/path/to/source/1|/path/to/source/2
For your implementation:
DataSource=/sitecore/website/news|/sitecore/website/events|/sitecore/website/articles
I would also add that the Treelist with Search field has been deprecated in later versions of Sitecore 7, so if that is the field that you are using then I advise changing to the Multilist with Search field. If you are using a standard Treelist field, then Ahmed's answer may be viable as well, depending on your use case.
Let me know if you have any questions. Good luck, and happy coding! :)
You can use IncludeTemplatesForDisplay parameter to filter the items based on templates:
DataSource=/Sitecore/Content/Home&IncludeTemplatesForDisplay=News Folder,News,Event Folder,Event
IncludeTemplatesForDisplay parameter accepts comma separated templates names, you might need to include parent folder templates names too so that it appear in treelist.
Hope this helps

Sitecore Relative Multilist

In Sitecore I have a folder called Models, a folder called Products and a folder called Years under my home item. In Models I have a a list of products. Models has a multilist that points to the Years item as it's data source. Products has a multilist which points to Models as a data source. I need to also give Products a multipicker that points to Years however these dates can only be dates that are available for it's selected Models. I need something that can pretty much look at the multilist of items chosen by a multilist as a datasource. I'm not sure if this is something possible out of the box. The reason I want to do this rather than nesting these three folders is to avoid duplicating content but I'm not sure if I can get around this.
I do not know a way out of the box. But I can think of a way where you could extend the Multilist and add it as custom field. Then override the source property and manipulate the value on set.
Here is an example where this is done to allow relative queries:
http://sdn.sitecore.net/Scrapbook/Custom%20TreeList%20that%20supports%20query.aspx
You would need to be aware of the selected models by getting the values from the corresponding field (using ItemID property to load the current item) and once you have that you could set the source to the years root folder and use data source parameters to exclude the ones you don't need.
Here is a good post about what options you have on the data source:
http://getfishtank.ca/blog/treelist-data-source-hidden-functionality
Downside of this is that you need to save the item before the custom tree is aware of the selected models. Another downside is that you might have to validate selected years because if you make changes in the selected models then the selected years could be invalid.
Don't think there is an out of box option for having cascading fields similar to what you described. You may need a custom field. Here is the full documentation on how to create a custom field in Sitecore
http://sdn.sitecore.net/Articles/API/Creating%20a%20Composite%20Custom%20Field.aspx

General Link Type Field - how to add another insert Option

I am using the General Link Field to insert a URL in Sitecore.
I want to create a custom insert option (Don't want to override the GeneralLink Field), but I can't find any documentation related to it. The new insert option is to enter tel schema links (eg: tel:99999999)
Does anyone have done this or has any idea?
I don't think you can do this at the moment. But if you would like to insert simple text (like an email address or a phone number) wihout additional infos (i.e. linking to a specific item with a specific alternative text etc.) I would recommend to using a Single-Line Text field with a specific validator. So the author is free to fill in a phone number/email and gets reminded if the format is not correct.
Looks like you would like to create a new menu item for general link if so switch to core database and add your custom menu item here /sitecore/system/Field types/Link Types/General Link/Menu.
You can insert this custom Link schema using "Insert Javascript" Option available on the General Link field.
OR you can create your own custom made general Link field to the Core DB and have it listed into the template .
You can find it out at this location : /sitecore/system/Field types/Link Types/General Link
Hope This Helps
You can use below given blog for reference
http://sitecorecode.com/index.php/2012/06/27/add-new-tab-in-general-link-field-type-of-sitecore/

Search tags/facets in Sitecore Item Buckets

I'm looking to use the Sitecore Item Buckets package from Shared Source since I needed faceted search functionality and it makes sense to use the built in functionality rather than writing by own Lucene.Net search.
Sitecore Item Buckets
I'm having trouble with the search, or maybe I am reading the documentation wrong.
According to the documentation in section 2.2.3 & 3.1.3 I just need to mark a field as "Is Facet" and my filter will show in the search results.
I've also defined a tag field on the template and changed the Tag Parent field in "/sitecore/system/Modules/Item Buckets/Item Buckets Settings" to point to correct folder. This is working correctly, I can apply a set of tags to an item and search from the Bucket UI using "tag:CSharp" and it brings back the correct results, but again there is no filter shown in the list. I've rebuilt the bucket indexes in all cases.
Am I missing something? Should these show up in the list automatically, do I need to change some settings or provide my own implementation?
Screenshot
This is all within the Buckets Client UI, I haven't started writing any code yet, and on a clean install of Sitecore 6.5 (update-5/rev. 120706).
I'm not sure the documentation wording around this is entirely clear at the points I've mentioned. If you read further down the document though, section 4.3:
Item Buckets ships with 5 different types of faceting.
Templates
Fields
Dates
Locations
Authors
If you would like to introduce your own faceting categories then you only need to implement the IFacet interface.
There is an example of IFacet implementation in the documentation, or use dotPeek to look at the implementations of the existing Facets.
You also need to add an item to Sitecore: /sitecore/system/Modules/Item Buckets/Facets

Find all the item that is using a common Sublayout in sitecore 6.2.0

Is it possible to obtain a list of all the items in sitecore that is using common sublayout or XSLT's in presentation tab for rendering i.e. suppose there is sublayout called layout1.ascx that is being used by 5 items.is it possible to obtain the list of all these 5 items by search method.
Thanks in advance.
Regards,
Divya
You probably need to do this in two steps (or one if it's only 1 template).
You need to use the Link database.
The simplest way of seeing these "links" is to go to the Sublayout or Rendering and go to the "Navigation" menu and then click on "Links". This should show you all the items that point to this current item and all the items that the current items points to (ie. both ways).
This will probably give you a list of templates and/or items (if the sublayout is set directly on an item).
Then go to a template and see how do the same to see which items are have a refernce to the template.
This should show you which items are using which sublayouts.
Of course this requires the Link database is up to do (should be done automatically, but you can force this with Start > Control Panel > Databases > Rebuild Link Database) and that the Sublayouts etc are bound in Sitecore..
I hope this helps.
The Link database suggestion is great, but if your sublayout is used by hundreds of items, it may take a little while to load.
Another alternative is this fast query:
fast://*[#__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%' or #__Final Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']
This can be run in the developer center, under Tools > XPath Builder (or for Sitecore 8.x the XPath Builder can be found at /sitecore/shell/default.aspx?xmlcontrol=IDE.XPath.Builder).
Sitecore 9.x no longer supports the XPath Builder, but you can still run this if you install the Sitecore PowerShell Extensions.
The following command can be run:
Get-Item -Path "master:" -Query "fast://*[#__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%' or #__Final Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']"
Change the guid above as needed.