Hi,
I would like to set a dynamic property from a normal page property. The purpose is to make it easier for the editor so that they don't have to care about dynamic properties.
I'd like to do this on every startpage save. What event should I use? DataFactory.Instance.SavedPage doesn't seem to work, the event doesn't fire when I click Save or Save and view. However if I use DataFactory.Instance.PublishedPage it works fine when I click Save and publish.
Code of what I'm trying to achieve:
PropertyData prop;
DynamicProperty dynProp;
// Site Scheme
prop = e.Page.Property["SiteScheme"];
if (prop != null && !prop.IsNull) {
dynProp = DynamicProperty.Load(e.Page.PageLink, "GlobalSiteScheme");
dynProp.PropertyValue.Value = prop.Value;
dynProp.Override = true;
dynProp.Save();
}
Hi Mattias!
A bit late answer but do you really want to update the dynamic property when an editor only saves a start page? As the dynamic propeties go live directly you probably want to use the published-event to update the dynamic properties.
PropertyData prop; DynamicProperty dynProp; // Site Scheme prop = e.Page.Property["SiteScheme"]; if (prop != null && !prop.IsNull) { dynProp = DynamicProperty.Load(e.Page.PageLink, "GlobalSiteScheme"); dynProp.PropertyValue.Value = prop.Value; dynProp.Override = true; dynProp.Save(); }