What are different types of Field types in Sitecore? – Part I

This blog is very simple and it will concentrate on different type of Fields types which we have in Sitecore. Also Ill explain the some other fields like Source, Shared and Unversioned.

So hope you are enjoying the series and I am able to deliver the content which you need. In case you are looking for something else or have any queries, please get in touch with me from the Contact page.

To learn the field types, we will divide them in different categories and will go through it one by one:

  1. Text
  2. Date Time
  3. Checkbox
  4. Image
  5. Link
  6. Drop down
  7. Multiple Values

These are the common categories we come across and has multiple fields for all these categories.

So to start we will create some custom templates.

  1. Go to Sitecore (http://learningsitecore/sitecore)
  2. Enter your credentials (admin/b)
  3. Go to Content Editor interface.
  4. Expand Templates item.
  5. Select User Defined item (/sitecore/templates/User Defined)
  6. Right click >> Insert >> New Template
  7. Name the template “Field Types” and Click Next.
    VS17
  8. Again click Next and Close.
  9. Now you will get a screen to create your custom template.
    VS18
  10. Lets create the sections based on the Categories we have.
    VS19
  11. So what we have done is, we have created 4 Categories in the beginning namely, Text Category, Date Time Category, Check box Category and Image Category.
  12. Each category has certain fields and field types.
  13. Text Category – In text we can use Single-Lined Text, Multi-Lined Text and Rich Text field types. As name mentions, single line text will be used for short phrases or titles. Multi lined will be used for fields like Summary which does not need any styling. And Rich Text will be used for the fields like Description which needs styling of the text like making it bold or Italics or adding bullet points,  etc.
  14. It is highly recommended to make minimal use of Rich text fields as it can distort or override the website design or styling.
  15. Now if you can see there are 3 fields (Source, Unversioned and Shared) for each field.
  16. Lets understand what are these fields.
    Versioned fields
    By default every field in Sitecore is a versioned field. These fields can have separate language versions and several numbered versions for each language version. To mark a field as versioned do not check Shared and Unversioned check boxes while creating the template.Shared fields
    While creating the templates, we need to check the Shared checkbox to make a field ‘Shared’. The data in the Shared fields are shared among all languages and all numbered versions. So if you make a change in one language version of an item it would reflect in other languages and their numbered versions. These type of fields are used mainly if there is some data whose value need not to b versioned at all. Like a profile image or something.

    Unversioned fields
    While creating the template, we need to check the Unversioned checkbox to make a field Unversioned. The data in the Unversioned fields are separate for each language version but all the numbered versions share the same data. Select this type of field if you need to maintain different data for different languages but do not need numbered versions. Like a product name field, as it could be different in different languages and you might have decided not to maintain numbered versions.

  17. So based on the above definitions and our requirements we can use the fields unversioned and shared.
  18. Now what remains is the “Source” field, this plays different role based on the field types. ex. it is not used in Single line and multi line but is helpful in Rich text fields.
  19. There are four different types of rich text editor versions which sitecore provides to us, namely Rich Text Default, Rich Text Full, Rich Text IDE, and Rich Text Medium. These 4 versions mean the functionality are enabled based on the version we use. By default it is ‘Rich Text Default’ where we need to add anything in Source field but in case we need to enable any other version then we need to add it in Source field. Please go through this blog to understand  how to enable the other versions of Rich text editor.
  20. Now we have Date Time Category – In this category, we have only 2 field types, i.e. Date and DateTime and as name suggests I don’t think, I will need to explain it. Here we will check how these fields look when we create an item.
  21. Similarly in the Check box and Image category we have one field type each. Both these fields are self explanatory.
  22. So lets create a item out of this template and lets check how this fields look.
  23. Go to Home item (/sitecore/content/Home)
  24. Right Click >> Insert >> Insert from Template.
  25. In the pop window, navigate to the Field Types template and in the Item Name, enter ‘Demo1’.
    VS20
  26. Click Insert.
  27. Now if you collapse all the sections then you can see that there are total of 5 sections got created out of which 4 are the ones which we created and other is Quick Info which will be there for each sitecore item.
  28. Now expand Text Category section and see how all the fields look.
    VS21
  29. In the richtext field, we get to insert HTML or we can write plan text and give styling like we do in MS Word.
  30. Now expand Date Time category section.
    VS22
  31. So from the way the fields are rendered here, we can understand when to use Date field type and when to use DateTime field type. Untill and unless the timestamp is not required, you can use ‘Date’ type.
  32. Expand Check box Category.
    VS23
  33. The checkbox is very useful field type and we can just read it as 1 or 0 in backend.
  34. Expand the Image Category.
    VS24
  35. Browse helps you to browse the Image in media Library or upload it and select the Image.
    VS25
  36. This completes our 4 categories out of 7 we mentioned above.

Since I don’t want to stretch everything in one blog which becomes boring, so I will split this topic into 2 blogs and explain the remaining 3 categories in the other one.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

2 thoughts on “What are different types of Field types in Sitecore? – Part I

  1. Pingback: What is template and how to create it? | Sitecore Dairies

  2. Pingback: What are different types of Field types in Sitecore? – Part II | Sitecore Dairies

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s