Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am reading all the Schemas using core service from the Building Block folder, after reading the schema, I am reading all the field from a particular Schema. I successfully get all the field from a particularly Schema, but i didn't find any method for get the field type in the "ItemFieldDefinitionData" class then how i get the field type.

i wrote following code for reading the schema and all the field.

   OrganizationalItemItemsFilterData f=new OrganizationalItemItemsFilterData();

    ArrayOfItemType ai=new ArrayOfItemType();
        List<ItemType> cpList =ai.getItemType() ;
        ArrayOfIdentifiableObjectData systemWideListSchema = client.getList("tcm:397-27454-2",f);

        System.out.println("in read");

        for (IdentifiableObjectData iod : systemWideListSchema.getIdentifiableObjectData()) 
            SchemaData schemaData=(SchemaData)iod;

               SchemaData sdata=(SchemaData),new ReadOptions());
               SchemaFieldsData schemaFieldsData = client.readSchemaFields(sdata.getId(), false, null);
              ArrayOfItemFieldDefinitionData aFiled = schemaFieldsData.getFields();  
              List<ItemFieldDefinitionData> l= aFiled.getItemFieldDefinitionData(); 

              for(ItemFieldDefinitionData i:l)
              { System.out.println("in schema Filed");
              //Here i want to get the type of field
share|improve this question
up vote 3 down vote accepted

ItemFieldDefinitionData is the root class in the hierarchy:


So you can get the exact class with GetType, like i.GetType().Name, for example. This will return you the underlying class, which corresponds to the field type, for instance DateFieldDefinitionData

share|improve this answer
Thanks @user978511 by using the method getClass() i get instance of particually field Type class – pankaj Sharma Aug 1 '14 at 7:41
You can also do a strongly-typed check by using something like "if (i is MultiLineTextFieldDefinitionData) { ... }" – Peter Kjaer Aug 1 '14 at 13:53
Yes, but he wanted to print out the field type – Andrey Marchuk Aug 1 '14 at 13:56

For this kind of work, you should definitely look at the Change Content or Metadata recipe in the Tridion Cookbook. There you will find a very useful library that exposes, among other things, the field types.

share|improve this answer
Update: user978511 and I seem to have posted simultaneously... so for clarity - the library I mentioned exposes the type as a property, and you still have to read the name yourself, so it's really the same technique. Even so, I'd still check out the library. – Dominic Cronin Aug 1 '14 at 7:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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