12

Default value is ABC, standard value $name. I only get ABC for the item added in the content tree.

May be my standard values are corrupt and need to reset. But what is the difference between these 2?

EDIT: token($name) works in default too but this example is for clarity

1
  • standard values are language based. But default works regardless Oct 6, 2017 at 18:43

5 Answers 5

11

From my understanding

Default Value

In the definition item for each data template field, you can specify a value for the Default value property. When a user creates an item, Sitecore copies the default value from the field definition item into the corresponding field value in the new item.

Standard Value

The Standard Value can be a token or set of selection from a multilist which is set onto the item upon creation.

Most of the time, we tend to use Standard Value rather than Default Value. It is only based on your requirement

You may read the following links:

1
  • As per my understanding default value is taken while item is created and standard value acts as a fallback. So if default value is inserted at item creation time, then there will be value for that field and hence it should not fall back to standard values. So initial value should come instead of standard values while creating the item. But when I tried the item is taking standard values even if default value is there in the field.
    – Anjo
    Sep 4, 2018 at 9:50
9

It is a quite interesting question. I've never thought about it. I fully agree with previous answer except using tokens. Tokens can be used in the Default Value as well as in the Standard Value. I also want to add some differences between them:

  • Default Value is a shared field and if you develop a multi language solution it will be impossible to set a default value in each language;
  • If you use Default Value for setting default value for droplink (for example), it will be more difficult because you should set an ID as a value manually. In case using Standard Value you can select the value in dropdown.

In general, Default value is obsolete and using the Standard Values is a best practices.

3

Similarities

Standard values and default values work very similarly, in that the both store values which are used on all derived items that do not specify their own values for those fields. So the value of many items are all controlled in a single place. Change it in that one place and the items all update. You can prevent updates to individual items by entering a different value for that item.

Differences

The difference is that the standard values are stored in a __Standard Values item and the default values are set on the field definition item. Also standard values override default values. When you create a new __Standard Values item, any fields with a default value will be pre-populated on the standard values item. And updating the default value will update the value on the standard values item. This is true unless you modify that field on the standard values item, then it will no longer update with the default value. Also, you can have multiple standard values, if you derive template B from template A, both can have standard values, but only the place where the field is defined can specify default values.

Example

Given a template with the following fields d, s, ds.

enter image description here

  1. You set the default value of d and ds to "default" and do not set the default value of s.
  2. Create the standard values item and notice that d="default", s="", ds="default". The default values pre-populated in the __Standard Values item

  3. Now create two new items from this Foo template (foo and foo2) and notice that d="default", s="", ds="default" for both items.

  4. Don't change any fields on foo, but on foo2, change all 3 fields to "custom"

  5. Now on the __Standard Values item, set s and ds to "standard" and leave d unchanged.

  6. Notice that the content item foo should now be d="default" s="standard" and ds="standard". However foo2 values are all still set to "custom"

  7. Now go back to the d and ds field definition items under your template and set the d and ds default values both to "default2"

  8. Go back to the __Standard Values item and notice that d="default2" while ds="standard". By setting ds="standard" earlier, you unlinked it from the default value, but d is still linked, so changes to the default value will reflect in the standard values item.

  9. Now go to the foo and foo2 content items. foo should be d="default2", s="standard" and ds="standard". foo2 should be d="custom", s="custom", and ds="custom". Notice how default values can pass all the way through to content items if they are not overridden in the standard values or on the content items themselves.

Long story short, the standard values update to match the default values for all fields that are unchanged. The content items update to match the standard values for all fields that are unchanged.

2

Default Value is obsolete. It dates back to the days before Standard Values (Sitecore 5.0-5.2 series if I recall correctly). You should stick with Standard Values if at all possible.

3
  • difference was the question about Oct 9, 2017 at 19:12
  • 1
    Obsolete is a difference :) Oct 9, 2017 at 19:39
  • 1
    Please link any official statement or document stating this is obsolete Oct 23, 2017 at 13:42
0

Default Value: static you can't change its fixed.

for example: Product Name field : abc (default value) newly created item has the same value abc Here we can't use token etc.

Standard Value: Dynamic changes at runtime.

for example: Poduct Name field : $name (default value) newly created item get current item item Here we can use token.

Thanks,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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