Versioned vs Shared vs Unversioned fields in Sitecore
This post explains what templates and fields are in Sitecore and the differences between the Versioned, Shared and Unversioned fields in Sitecore. It also states the scope of each of these fields in different scenarios.
Templates and Fields in Sitecore
Templates will have a list fields of different types grouped into sections. So each of these templates can be used for creation of items and thus the items get all the fileds of the template which it is using.
Versioning in Sitecore
As Sitecore supports versioning of items, it also provides a list of options about the versioning of fields of items/templates. The options we have for each of the field while creating the template are Versioned, Shared, Unversioned. Let us see in detail about each of these types.
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 checkboxes while creating the template.
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.
When a field is shared, it will be visible from the item using that template. Say there is an item called 'Sample Item', with a shared field 'Title', then there is a small note '
[Shared]' visible beside the field in all the items which are using this template.
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.
Similar to the shared fields, unversioned fields will also carry a small note '
[Unversioned]' beside the field name.
Unversioned, Shared fields
What if you have checked both Unversioned and Shared? - As the shared fields does not maintain language or numbered versions, if we select both 'Unversioned' and 'Shared', the fields would be acting like 'Shared' fields. So it does not make any affect checking or unchecking 'Unversioned' checkbox after selecting the 'Shared' checkbox.
Fields which are marked as Shared and Unversioned will carry a small note '
[Unversioned, shared]' beside the field name
Hope it helps. Please comment your feedback and thoughts if any.