In our Sitecore application, we have a template called NewsArticleSlide which renders a news article on a carousel slide. This template has a field called "News article" which contains the ID of the news article being rendered. The type of this field up to now has been droplink, which has been perfect for selecting a single item from a tree, and specifying what the root of that tree should be.
Now we've decided to contain all news articles in a single bucket called "News". The problem is that we can't now use droplink to select an item from the bucket, and no "droplink with search" field type exists.
QueryBuilder seems like the best fit as it enables us to select a single item from a bucket. However, when we initially run a search, everything in Sitecore is returned and we then have to filter by template to see only news articles.
What we want to do is pre-filter the search by specifying the starting point for the search, and limiting the search to only return items of a particular template. We assumed we could do this using parameters in the Source of the template field, but have had no success doing this.
Does anyone know how we can do this? Is QueryBuilder the right approach?
You can accomplish this by changing your Droplink
field to a Multilist with Search
field instead. Here's a blog post showing you the options for restricting the values in the list from your bucket.
Now one key thing here is that this field type is a multi-select field, but you may only want to use it to select a single News Article. You can use a RegEx to force only one selection:
Validation
field enter this RegEx: ^(\{[^}]+\}\|?){0,1}$
Validation Text
field enter a message, e.g. "You may only select up to 1 item."This will allow you to use a Multilist with Search field to select a single item within a bucket.