Hello
In the OnBeforeUpdate method of a custom webnodes class I need to retrieve the objects that are currently being added to a Content children property (RelatedProducts).
I thought I could do it like this (I've done this successfully for string properties, only with GetDataValue instead of GetDataValueRelation):
IDataValue dValueRelatedProducts = GetDataValueRelation(MyProduct.PropertyIdRelatedProducts);
if (dValueRelatedProducts.Changed)
{
List<MyProduct> relatedProducts = (List<MyProduct>)dValueRelatedProducts.ObjectValue;
}
But ObjectValue throws an exception:
This property is not supported by this datavalue type.
at WAF.Data.DataValue.NodeRelationsDataValue.get_ObjectValue()
at WAF.Engine.Content.....OnBeforeUpdate() in .....
at WAF.Engine.Content.ContentBase.UpdateChanges(Boolean updateChangeDate, Boolean invokeEventMethods, Boolean queChangesForIndexing)
at WAF.Engine.Content.ContentBase.UpdateChanges(Boolean updateChangeDate, Boolean invokeEventMethods)
at WAF.Engine.Content.ContentBase.UpdateChanges()
at WAF.Engine.Presentation.Web.WMSearchAndSelect.onFound(WorkflowMethod invoker)
at WAF.Engine.Workflow.WorkflowMethodCaller.callMethod_ExecuteCode(Object sender, EventArgs e)
What am I doing wrong? I'm only interested in the values added in the current update, not all values of the property.