Using Dynamic Values

Using Dynamic Values

Dynamic Tokens supported by Sitecore

  • $name  populates the field with the value of the item key when the item is first created
  • $date populates the field with the current date when the item is first created
  • $time populates the field with the current time when the item is first created
  • $now populates the field with the current date and time when the item is first created
  • $id populates the field with the item's GUID when the item is first created
  • $parentname populates the field with the value of the parent's item key when the item is first created
  • $parentid populates the field with the value of the parent's GUID when the item is first created

Field Types that Support Dynamic Tokens

  • Single line Text
  • Multiline Text
  • Rich Text


C# Web Control Code

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

Sitecore.Data.Items.TemplateItem template = db.Templates["templatepath"];

Sitecore.Data.Items.Item item = template.StandardValues;

item. ItemEditing.BeginEdit();

item.Fields["fieldname"].Value = "$name";

item. ItemEditing.EndEdit();