Determine if a field contains Standard Values

Version: 10.4

You can determine whether a field contains its standard value by using the Sitecore.Data.Fields.Field.ContainsStandardValue property. For example, to determine if the Title field in the /Sitecore/Content/Home item in the Master database contains its standard value:

RequestResponse
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");

Sitecore.Data.Items.Item home = master.GetItem("/sitecore/content/home");

Sitecore.Data.Fields.Field titleField = home.Fields["title"];
{
    // Process
}

The Sitecore.Data.Fields.Field.ContainsStandardValue property is False if there is no standard value for a field.

A field can contain the same value as its standard value without actually containing that standard value. For example, an item contains its standard value. The user updates that field; the field no longer contains its standard value.

The user updates the field again, setting the value to the same value as the standard value for the field, but without resetting the field to its standard value. The field now contains the same value as its standard value; however, it does not contain its standard value.

The Sitecore.Data.Fields.Field.ContainsStandardValue property is False despite the fact that the value of the field is equal to its standard value.

Do you have some feedback for us?

If you have suggestions for improving this article,