I want to create a schema with a list field by using core service so I can select the keyword when I create a component. for this I create a "SingleLineTextFieldDefinitionData" type field but I did not find any method in SingleLineTextFieldDefinitionData class for the property of Values will be Selected from a List .

how I do this so I can select the category from the list and classify the component

  • 1
    I'm wondering, are you only using Visual Studio intellisense to see what is available? If so I can recommend downloading the SDL Tridion 2013 SP1 Core Service API reference guide (.chm file) from the documentation. That gives a much better overview of what members are available for a given class. Commented May 14, 2014 at 9:08

3 Answers 3


You need to use singleLineTextFieldDefinitionData.List to have list type field

SingleLineTextFieldDefinitionData singleLineTextFieldDefinitionData = new SingleLineTextFieldDefinitionData();
singleLineTextFieldDefinitionData.Name = "OptionField";
singleLineTextFieldDefinitionData.Description = "Option Field";
singleLineTextFieldDefinitionData.List = new SingleLineTextListDefinitionData()
    Entries = new String[] { "Yes", "No" }

Especially to target keyword related schema field with list type,

KeywordFieldDefinitionData keywordFieldDefinitionData = new KeywordFieldDefinitionData()
    Name = "MyList",
    Description = "It's My List",
    Category = new LinkToCategoryData()
        IdRef = "Category-TCM-ID"
    List = new ListDefinitionData()
        Type = ListType.Tree
  • thanks one more things I want to ask that in tridion gui when we checked the Values will be Selected from a List: property a category check box appear automatically and when we select the category checkbox our category are display in list how I do this using core service after list type field create Commented May 14, 2014 at 9:14
  • @pankajSharma: Updated with more detailed example related to keyword. Commented May 14, 2014 at 9:35
  • 1
    Check the schema source after you do it in the UI - this should give you enough pointers to "reverse-engineer" it. At least, that's what I would do.
    – Nuno Linhares
    Commented May 14, 2014 at 9:35
  • @NunoLinhares: Yeah that's a great point. Commented May 14, 2014 at 9:37

You should set SingleLineTextFieldDefinitionData.List property


For a text based option list you can use the SingleLineTextFieldDefinitionData.List property as explained in the given answers by @user978511 and @Siva.

If you want to populate the values in the list with Keywords from a Category, you will have to use the KeywordFieldDefinitionData class instead for your field. While in the SDL Tridion UI, it is initially shown as a Text field, this is underwater a Keyword field once you select a Category for the list.

The KeywordFieldDefinitionData.Category property is where you will be able to set the Category from which you need the Keywords. The KeywordFieldDefinitionData.List property should be automatically populated from that point onwards.

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.