torsdag den 27. november 2014

The Sitecore Source Property Explained - Part 2: Treelist Parameters

The treelist is a widely used multi-select Sitecore template field type. It enables the user to select any number of items from the Sitecore content tree. If you don't define a root item for the treelist, it will simply use the Sitecore-item as the root. The user can then navigate the content tree and select any items they desire. In some cases this might be fine. But more often than not, we can improve the user experience by simply setting a more suited root item in the treelists source property:
/Sitecore/Content/Home
This would set the home-item as the root of the treelist, so that the content author would only be able to navigate to and select items that are descendants of the home-item.

We can do a lot better than just setting a root item though. By defining a parameterized datasource, we can control what items are visible in the treelist, what items the user can select and more.

The Sitecore Source Property Explained - Part 1: Root Item

All Sitecore template field types have a source property. While this property isn't always used, it is a really powerful tool for filtering the data shown in various field types and improving the general user experience.