8

I'm building a template and I want to limit the items the authors can select on a TreeListEx field. I know this can be done specifying the datasource as posted here

Like setting the value on the Source field:

DataSource=/sitecore/content/home/foo&ExcludeTemplatesForSelection=Bar

This is fine, although you are hard coding a path which might not be desired if the ability to move items is desidered.

What if I'm setting an ID on the source field like shown here? How can I limit the selection?

enter image description here

3
  • I might be missing something, but is there a reason why you can't use the StartSearchLocation syntax and apply a filter on top of that? That way you would still be able to specify the ID of where to look, then apply the additional filtering? Oct 27, 2016 at 13:19
  • As far as I know StartSearchLocation is used for these types: Multilist with Search Treelist with Search Query Builder Query Datasource TreeListEX I don't think there is that option
    – Diego
    Oct 27, 2016 at 13:22
  • Right, my mistake. Oct 27, 2016 at 13:24

1 Answer 1

11

You can use the ID instead of the path in your initial source:

DataSource={C46A-4...CE}&ExcludeTemplatesForSelection=Bar
3
  • Hum I tried using the ID and changing the name for the template name on the ExcludeTemplatesForSelection but still I can add the value. I tried to set the template with it's id as well but still I can select it like this: DataSource={F1AF7A72-C46A-4FC2-BF3B-7325A4DDB0CE}&ExcludeTemplatesForSelection={19BEA9FA-08C7-4D8F-B1B8-08CA5D288B87}
    – Diego
    Oct 27, 2016 at 13:29
  • 2
    You can use the ID in the datasource, but not on the ExcludeTemplates..
    – Gatogordo
    Oct 27, 2016 at 13:31
  • 1
    thanks Gatogordo. that's useful. IT worked like this: DataSource={F1AF7A72-C46A-4FC2-BF3B-7325A4DDB0CE}&ExcludeTemplatesForSelection=MyTemplateName
    – Diego
    Oct 27, 2016 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.