---
title: "Controlling the list of items in a Selection field"
slug: "controlling-the-list-of-items-in-a-selection-field"
abstract: "How to control the items that appear in the selection list for fields that allow the user to select items."
---
# Controlling the list of items in a Selection field

The *Source* property of data template fields supports three techniques for controlling the items that appear in the selection list for fields that allow the user to select zero or more items.

> [!note]
> If you set the *Source* property of a data template field to a Sitecore query or Treelist parameter as described in the following sections, you might receive a prompt indicating that the Source field in the data template field definition item contains one or more broken links. You can ignore this warning and save the change to the data template field definition item.

## Root item

You can set the *Source* property of the following field types to a root item:

- Droplink
- Droplist
- Droptree
- File
- Grouped Droplink
- Grouped Droplist
- Image
- Multilist
- Treelist
- TreelistEx

For single-level lists, such as Checklist, Droplink, Droplist, or Multilist, users can select a child of the root item.

For grouped lists, such as Grouped Droplink and Grouped Droplist, users can select a grandchild of the root item.

For tree lists, such as Droptree, File, Image, Treelist, and TreelistEx, users can select a descendant of the root item.

For example, to allow selection from beneath the `/Sitecore/Content/Home` item, set the *Source* property as follows:

```
/Sitecore/Content/Home
```

## Sitecore query

You can set the *Source* property of a Checklist, Droplink, Droplist, Grouped Droplist, Grouped Droplink, or Multilist field to a Sitecore query using the `query:` prefix.

For example, to allow selection of children of the home item that are based on the data template named *Section*:

```
query:/sitecore/content/home/*[@@templatename='Section']
```

You can use built-in tokens such as `$site` or `$home` within queries, as in the following example. They are particularly useful when you have a multi-site setup with shared renderings. The tokens are resolved dynamically based on the current site context.

![Example of a token used in a query](https://doc.sitecore.com/api/markdown-image/sai/en/developers/sitecoreai/images/TokensScreenshot.png)

## Treelist parameters

You can set the *Source* property of a Treelist or TreelistEx field type to any number of key=value parameters separated by ampersand characters (&).

For example, to allow users to select descendants of the home item that are based on either the data template named *Section* or the data template named *Page*:

```
DataSource=/Sitecore/Content/Home&IncludeTemplatesForSelection=section,page
```

You can specify the following parameters:

- `DataSource` - root item.
- `DatabaseName` - the name of the database containing DataSource.
- `IncludeTemplatesForSelection` - users can only select items based on this comma-separated list of data template names.

    > [!note]
    > This query isn't yet supported in Pages, and won't restrict the list of templates that appear as a possible Source for a field.

- `ExcludeTemplatesForSelection` - users cannot select items based on this comma-separated list of data template names.
- `IncludeTemplatesForDisplay` - users can only navigate items based on this comma-separated list of data template names and IDs.
- `ExcludeTemplatesForDisplay` - users cannot navigate items based on this comma-separated list of data template names and IDs.
- `IncludeItemsForDisplay` - users can only navigate items based on this comma-separated list of item names and IDs.
- `ExcludeItemsForDisplay` - users cannot navigate items based on this comma-separated list of item names.
- `AllowMultipleSelection` - if yes, users can select the same item more than once.
