Skip to content

datastoreitem

Custom field type

All field types

A reference to a Datastore Item chosen by an editor.

Written as
"Type": "datastoreitem"
Valid on
Template fields, Datastore schema, and custom site settings
List form
datastoreitemlist — stores an array and accepts the same filters. It has no page of its own.
Validators
This type carries no validators.
Default value
The name of a Datastore Item, or Type:Name for a polymorphic reference.

Picker filters

Constrain which objects the editor offers. Every picker also accepts Exclude.

  • HasUrl
  • IncludeInSearch
  • SiteDomainGUID
  • TemplateGUID
  • FolderGUID
  • TagGUID
  • AuthorGUID
  • DatastoreGUID
  • DatastoreType
  • Query

Notes

A single picker carries no validators. Its datastoreitemlist variant does, and accepts minitems and maxitems to bound how many objects an editor may choose.

Query filters the picker's candidate set. Write it as a single JSON string in the same query language as the query argument of {% datastore_items %} (see Query Syntax), for example "featured = true and not archived". The fields are the candidates' custom FieldIDs. A JSON object with Type, FieldID and Value keys is not accepted: the import fails with an error. A string that does not parse is accepted but ignored, so the picker then offers every candidate. The definition is not checked when it is saved: a FieldID the candidates do not define matches nothing (except with !=), so test the picker after setting a Query. The CMS exports a Query in the same string form.

To restrict what the picker offers, TemplateGUID, FolderGUID, TagGUID, AuthorGUID and DatastoreGUID each take a JSON array of names or GUIDs, for example "DatastoreGUID": ["Liquid Methods", "Liquid Objects"]. A string, including a comma-delimited one such as "Liquid Methods,Liquid Objects", is ignored on import without an error and leaves the picker unrestricted, so the filter is absent from the next export. DatastoreType also accepts a single string.